GraphQL service for ibis tables. Ibis supports 20+ backends — DuckDB, PostgreSQL, Polars, BigQuery, etc. — so the same query API works across local files and remote databases. The schema is derived automatically.
Parquet files load with ibis.read_parquet. For hive-partitioned data, DuckLake (graphique.ducklake.register / attach) keeps partition metadata in a catalog so DuckDB can prune and count without scanning footers. Passing a PyArrow Dataset as a root is deprecated.
Usage
There is an example app which reads a parquet dataset.
env PARQUET_PATH=... uvicorn graphique.service:app
Open http://localhost:8000/ to try out the API in GraphiQL. There is a test fixture at ./tests/fixtures/zipcodes.parquet.
env PARQUET_PATH=... strawberry export-schema graphique.service:app.schema
outputs the graphql schema.
Configuration
The example app uses Starlette’s config: in environment variables or a .env file.
- PARQUET_PATH: path to the parquet directory or file
- NAME = ’’: GraphQL field on
Query; defaults to root type - COLUMNS = None: list of names, or mapping of aliases, of columns to select
Configuration options exist to provide a convenient no-code solution, but are subject to change in the future. Using a custom app is recommended for production usage.
App
For more options create a custom ASGI app. Call graphique’s GraphQL on an ibis Table. Use a Query type with table attributes for multiple roots, and to enable federation.
import ibis
from graphique import GraphQL, typed
# any ibis backend: DuckDB, PostgreSQL, Polars, BigQuery, ...
table = ibis.read_parquet(...) # or `ibis.connect(...).table(...)`
app = GraphQL(table) # Table is root query type
# multiple named fields, with optional federation keys
class Query:
name = table # or `typed(table, name, keys=...)`
app = GraphQL(Query)Start like any ASGI app.
uvicorn <module>:app
API
types
- Dataset: GraphQL interface over an ibis table.
Table: implements the Dataset interface. Adds typed row, columns, and filter fields from introspecting the schema.Column: interface for an ibis column. Each data type has a corresponding column implementation: Boolean, Int, BigInt, Float, Decimal, Date, Datetime, Time, Duration, Base64, String, Array, Struct. All columns have avaluesfield for their list of scalars. Additional fields vary by type.Row: scalar fields. Tables are column-oriented, and graphique encourages that usage for performance. A single row field is provided for convenience, but a field for a list of rows is not. Requesting parallel columns is far more efficient.
selection
projection
aggregation
ordering
reflection
schema: field names and types- optional: nullable for errors
toSql: compiles SQL query
Performance
Performance is dependent on the Ibis backend, which defaults to DuckDB. There are no internal Python loops. Scalars do not become Python types until serialized. Table fields are lazily evaluated up until scalars are reached, and automatically cached as needed for multiple fields.
For partitioned parquet datasets, DuckLake provides performance benefits over ibis.read_parquet; see graphique.ducklake.{register,attach} for helpers. python -m graphique.partition in graphique[cli] writes hive-layout parquet out-of-core.
Installation
pip install graphique[server,cli]
Dependencies
- ibis-framework (with duckdb or other backend)
- strawberry-graphql[asgi,cli]
- pyarrow
- isodate
- uvicorn (or other ASGI server)
Tests
100% branch coverage.
pytest [--cov]
