Web App

Postgres Integration


sourceThe name of the source, see sourcesmy-source
NameName for connectionPostgres
NamespaceNamespace for the connection, see namespacesdefault
portDatabase port5432
Database NameDatabase Namejaffle_shop
userDatabase user
passwordDatabase password

Your database will need to be accessible from wherever you are running the Grai server. If you are using Grai Cloud your database will need to be accessible from the internet.

Python Library

The postgres integration can be run as a standalone python library to extract data lineage from your instance of Postgres.

The library is available via pip

pip install grai_source_postgres

More information about the API is available here.


The library is split into a few distinct functions but if you only wish to extract nodes/edges you can do so as follows:

  from grai_source_postgres import PostgresIntegration
  from grai_schemas.v1.source import SourceV1
  source = SourceV1(name="my-source", type="my-type")
  postgres_params = {
    "username": "my-username",
    "password": "my-password",
    "host": "",
    "port": 5432
  integration = PostgresIntegration(source=source, namespace="metabase", **postgres_params)
  nodes, edges = integration.get_nodes_and_edges()