Client Library


The client library provides a programmatic interface to the various REST endpoints on the server. With it you can build rich tooling on top of your existing installation of Grai.


Install dbt Grai package with pip

pip install grai-client


Most interactions with the server will start with a client instance like so

from grai_client.endpoints.v1.client import ClientV1
client = ClientV1(url="", username='[your_username]', password='[your_password]')

Now that you have an instance of a client and have authenticated the client with the server you can begin playing with the library. It offers the start REST verb interface of GET, POST, DELETE, and PATCH. e.g.

# Gets a list of nodes in your lineage graph

Each verb operation can take a variety of arguments like node, edge, and workspace but is primarily designed to work with structured objects from the grai_schemas library. For example, if you wanted to create a new node in your lineage you could do the following


A source refers to the source of the data. This could be a database, a file, a custom script, and more. In this example we are using a custom script as the source of the data and need to create the source before we can create the node.

from grai_schemas.v1 import SourcedNodeV1
from grai_schemas.v1.source import SourceSpec
my_source = SourceSpec(name='my_custom_script')
my_node = SourcedNodeV1.from_spec({
    'name': 'node01',
    'namespace': 'default',
    'data_source': my_source,
    'is_active': True,
    'data_source': 'dbt',
    'display_name': 'A Super Cool Node',