Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

trustfall

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

trustfall

A query engine for any combination of data sources. Query your files and APIs as if they were databases!

  • 0.2.0
  • PyPI
  • Socket score

Maintainers
1

trustfall — Python bindings

Use the Trustfall query engine from Python.

API

Create a schema object:

from trustfall import Schema

my_schema = Schema(
    """
    Your schema text here, written in GraphQL SDL.

    See an example schema here:
    https://github.com/obi1kenobi/trustfall/blob/main/pytrustfall/numbers.graphql
    """
)

Create an adapter with which to query the schema:

from typing import Any, Dict

from trustfall import Adapter

# Choose the type that is used to represent data vertices:
Vertex = Dict[str, Any]

class MyAdapter(Adapter[Vertex]):
    # Implement the four abstract methods from Adapter.
    ...

Execute queries:

from trustfall import execute_query

my_adapter = MyAdapter(...)

my_query = """
query {
    # your query here
}
"""
args = {
    # query arguments here
}

results_iterator = execute_query(
    my_adapter,
    my_schema,
    my_query,
    args,
)
for result in results_iterator:
    print(result)

Installing trustfall

This package is a wrapper around the Trustfall query engine, which is written in Rust.

Wheels are available for Windows, macOS (both x86 and ARM), and Linux (manylinux), for each supported version of CPython (3.9+).

This package should work on other platforms as well, in which case its Rust components may need to be compiled from source as part of the installation process.

If you get errors while installing this package, please report your OS and architecture info in an issue.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc