• Stars
    star
    2,399
  • Rank 19,179 (Top 0.4 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created almost 3 years ago
  • Updated 19 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

Trustfall β€” Engine for Querying (Almost) Everything

Trustfall is a query engine for querying any kind of data source, from APIs and databases to any kind of files on disk β€” and even AI models.

Try Trustfall in your browser

The Trustfall Playground supports running queries against public data sources such as:

For example, this link shows the results of the HackerNews query: "Which GitHub or Twitter users are commenting on stories about OpenAI?"

In the Playground, Trustfall is configured to run client-side as WASM, performing all aspects of query processing (parsing, compilation, and execution) within the browser. While this demo highlights Trustfall's ability to be embedded within a target application, it is of course able to be used in a more traditional client-server context as well.

10min tech talk + demo

Trustfall was featured in the "How to Query (Almost) Everything" talk talk at the HYTRADBOI 2022 conference.

Terminal recording of running cargo run --release -- query example_queries/actions_in_repos_with_min_10_hn_pts.ron in the demo-hytradboi demo project. The system returns the first 20 results of the query in 6.36 seconds."

Demo from the talk showing the execution of the cross-API query: "Which GitHub Actions are used in projects on the front page of HackerNews with >=10 points?"

The demo executes the following query across the HackerNews and GitHub APIs and over the YAML-formatted GitHub repository workflow files:

{
  HackerNewsTop(max: 200) {
    ... on HackerNewsStory {
      hn_score: score @filter(op: ">=", value: ["$min_score"]) @output

      link {
        ... on GitHubRepository {
          repo_url: url @output

          workflows {
            workflow: name @output
            workflow_path: path @output

            jobs {
              job: name @output

              step {
                ... on GitHubActionsImportedStep {
                  step: name @output
                  action: uses @output
                }
              }
            }
          }
        }
      }
    }
  }
}

Instructions for running the demo are available together with the source code in the demo-hytradboi directory: link.

Examples of querying real-world data with Trustfall

Trustfall also powers the cargo-semver-checks semantic versioning linter. More details on the role Trustfall plays in that use case are available in this blog post.

Using Trustfall over a new data source

The easiest way to plug in a new data source is by implementing the BasicAdapter trait.

Python bindings are available, and are built automatically on every change to the engine; the most recent version may be downloaded here. A getting started guide for Python is forthcoming (tracking issue); in the meantime, the best resource is the Python bindings' test suite.

Directory Registry

  • trustfall is a faΓ§ade crate. This is the preferred way to use Trustfall.
  • trustfall_core contains the query engine internals
  • trustfall_derive defines macros that simplify plugging in data sources.
  • pytrustfall contains Trustfall's Python bindings
  • trustfall_wasm is a WASM build of Trustfall
  • trustfall_filetests_macros is a procedural macro used to generate test cases defined by files: they ensure that the function under test, when given an input specified by one file, produces an output equivalent to the contents of another file.
  • experiments contains various experimental projects such as the Trustfall web playground.

Copyright 2022-present Predrag Gruevski.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

The present date is determined by the timestamp of the most recent commit in the repository. By accessing, and contributing code, comments, or issues to this repository, you are agreeing that all your contributions may be used, modified, copied, and/or redistributed under any terms chosen by the original author and/or future maintainers of this project.

More Repositories

1

cargo-semver-checks

Scan your Rust crate for semver violations.
Rust
1,131
star
2

cargo-semver-checks-action

A GitHub Action for running cargo-semver-checks
TypeScript
60
star
3

typing_copilot

Helper for starting to type-hint large codebases with mypy.
Python
37
star
4

monad_compiler

A compiler for the MONAD language from Advent of Code 2021 Day 24
Rust
20
star
5

trustfall-rustdoc-adapter

Trustfall adapter for querying rustdoc
Rust
10
star
6

ychacks2014

A hackathon adventure
JavaScript
7
star
7

pyre

6.858 final project -- Python exploitation of PC-remote-control mobile apps
Python
5
star
8

graphql-compiler-cross-db-example

A demo of the GraphQL compiler's cross-database querying capabilities
Jupyter Notebook
4
star
9

trustfall-rustdoc

Trustfall adapters for various rustdoc JSON format versions
Rust
4
star
10

python-bootstrap

A baseline Python project with all tooling set up
Python
3
star
11

kerbal-api

Programmatically querying Kerbal Space Program information, such as part characteristics
Python
3
star
12

advent-of-code-2021

Rust
2
star
13

crates-rustdoc

Rustdoc JSON for top crates, generated by crates-rustdoc-gen
2
star
14

ascension-bot

A system to play the Ascension: Chronicle of the Godslayer board game in an automated fashion for the purposes of game-theoretic analysis of various strategies.
Python
2
star
15

crates-rustdoc-gen

Rustdoc JSON generator for the top crates on crates.io
Rust
2
star
16

advent-of-code-2020

Rust
2
star
17

jester

An authentication system that enables two-factor authentication (2FA) using only client-side Javascript, without relying on any special server-side APIs other than password-based login and password changes for authenticated users.
CoffeeScript
2
star
18

kosmos

Explorations in KSP space exploration with kOS
1
star
19

advent-of-code-2022

Solutions for Advent of Code 2022
Rust
1
star
20

obsidian

Language analysis system
CoffeeScript
1
star
21

livedrop

An end-to-end encrypted photo sharing app using only free-to-use services, where the only trusted parties are the photo sender and recipient.
CoffeeScript
1
star
22

diego

A flexible transaction conflict-resolution framework written in Go
Go
1
star