Pre-release
This release is a pre-release and may not be stable for production use.
graphql-db-api

A Python DB API 2.0 for GraphQL APIs
This module allows you to query GraphQL APIs using SQL.
SQLAlchemy support
This module provides a SQLAlchemy dialect.
from sqlalchemy.engine import create_engine
engine = create_engine('graphql://host:port/path?is_https=0')
Example Usage
Querying Connections
from sqlalchemy import create_engine
from sqlalchemy import text
# We use GraphQL SWAPI (The Star Wars API) c/o Netlify:
engine = create_engine('graphql://swapi-graphql.netlify.app/.netlify/functions/index')
with engine.connect() as connection:
# Demonstration of requesting nested resource of homeworld
# and then selecting fields from it
for row in connection.execute(text("select name, homeworld__name from 'allPeople?include=homeworld'")):
print(row)
Querying Lists
from sqlalchemy import create_engine
from sqlalchemy import text
engine = create_engine('graphql://pet-library.moonhighway.com/')
with engine.connect() as connection:
for row in connection.execute(text("select id, name from 'allPets?is_connection=0'")):
print(row)
Superset support
In order to use with Superset, install this package and then use the graphql protocol in the SQLAlchemy URI like: graphql://swapi-graphql.netlify.app/.netlify/functions/index. We install a db_engine_spec so Superset should recognize the driver.
Roadmap
- Non-Connections top level
- Path traversal (basic)
- Path traversal (basic + nested)
- Path traversal (list / connection)
- Bearer Tokens in
AuthorizationHeader - Advanced Auth (e.g. with token refresh)
- Passing Headers (e.g. Auth in other locations)
- Filtering
- Sorting
- Relay Pagination
Release files for sqlalchemy-graphqlapi 0.0.1.dev4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sqlalchemy-graphqlapi-0.0.1.dev4.tar.gz | 12.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sqlalchemy_graphqlapi-0.0.1.dev4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.1 kB
Release files / sqlalchemy-graphqlapi-0.0.1.dev4.tar.gz
| Download URL | sqlalchemy-graphqlapi-0.0.1.dev4.tar.gz |
|---|---|
| Size | 12.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f1cc697e344fcea6e76a29bf4fc767336916264a50af89dae9170070556ed6b0
|
|
BLAKE2b-256 checksum How to use checksums |
d6787724bb8c21a59ac961fac42fea9d8a6f7e1a24900168efd8141c1a117db8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.2
|
Release files / sqlalchemy_graphqlapi-0.0.1.dev4-py3-none-any.whl
| Download URL | sqlalchemy_graphqlapi-0.0.1.dev4-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3fdbc348b11ac634550961afa006e84af45057e82553f6cd13d63258abe6ad83
|
|
BLAKE2b-256 checksum How to use checksums |
7177f85fae494f7f6f947ffd0386dee40a583fc2459ccedb7055cf948986bc3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.2
|