This connector allows you to write Python code and call it using Hasura!
With Hasura, you can integrate -- and even host -- this business logic directly with Hasura DDN and your API.
You can handle custom business logic using the Python Lambda data connector. Using this connector, you can transform or enrich data before it reaches your customers, or perform any other business logic you may need.
You can then integrate these functions as individual commands in your metadata and API. This process enables you to simplify client applications and speed up your backend development!
This connector is built using the Python Data Connector SDK and implements the Data Connector Spec.
- The DDN CLI and Docker installed
- A supergraph
- A subgraph
The steps below explain how to Initialize and configure a connector for local development. You can learn how to deploy a connector — after it's been configured — here.
ddn auth login
Once you have an initialized supergraph and subgraph, run the initialization command in interactive mode while providing a name for the connector in the prompt:
ddn connector init python -i
The CLI will ask for a specific port to run the connector on. Choose a port that is not already in use or use the default suggested port.
Introspecting the connector will generate a config.json
file and a python.hml
file.
ddn connector introspect python
You can add the models, commands, and relationships to your API by tracking them which generates the HML files.
ddn connector-link add-resources python
You can run your connector locally, or include it in the docker setup.
To include your connector in the docker setup, include its compose file at the top of your supergraph compose.yaml
file like this:
include:
- path: app/connector/python/compose.yaml
To run your connector outside of Docker first go into the connector directory:
cd app/connector/python
Install the requirements:
pip3 install -r requirements.txt
Then run the connector locally:
ddn connector setenv --connector connector.yaml -- python3 functions.py serve
View the full documentation for the Python Lambda connector here.
Check out our contributing guide for more details.
The Turso connector is available under the Apache License 2.0.