Python DB-API and SQLAlchemy interface for GraphQL APIs.
Project description
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
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)
Installation
I was having issues with apsw-3.9.2.post1
(the newest version of apsw
that would install for me from PyPI) and ended up needing to follow the instructions here to build / install apsw
from source. There is an open ticket on the APSW project to provide newer wheels. The issue might be triggered if the table name needs escaping and the error looked like:
SystemError: <method 'execute' of 'apsw.Cursor' objects> returned NULL without setting an exception
Roadmap
- Non-Connections top level
- Path traversal (basic)
- Path traversal (basic + nested)
- Path traversal (list / connection)
- Bearer Tokens in
Authorization
Header - Advanced Auth (e.g. with token refresh)
- Passing Headers (e.g. Auth in other locations)
- Filtering
- Sorting
- Relay Pagination
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for sqlalchemy-graphqlapi-0.0.1.dev3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c52144bc3e765f9b846a2e1af8d214c3014f12b4e1bb431d96094ec8d5fb7d3 |
|
MD5 | e3063c59767dcb6c5bf1f0d05250f677 |
|
BLAKE2b-256 | 7793591f1c2669897a2632dca4c25ee946fad0d2f30f82afa7580380baa1a361 |
Close
Hashes for sqlalchemy_graphqlapi-0.0.1.dev3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0db8809e160727a3327bc0cdc4a53c430c9ef735643089fa93a18f90c44b69f9 |
|
MD5 | ec0a220353b88bd5936fe25a62f906b5 |
|
BLAKE2b-256 | 7a2dd8b99e4804ece33d5ee15b2445137d0485fbb9bbb024bb0f2d5ed093a76f |