Custom Integration
Overview
Create a custom integration and upload nodes using JSON
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
[
{
"name": "Finance Mart",
"node_type": "Datasource",
"attributes": {
"description": "This is my first datasource"
},
"lineage": {
"upstream_dependencies": [
{
"table_name": "order_items"
}
]
}
},
{
"name": "Daily Revenue",
"node_type": "Chart",
"attributes": {
"description": "This is my first chart"
},
"lineage": {
"upstream_dependencies": [
{
"integration_name": "MyParadimeIntegration",
"node_type": "Datasource",
"node_name": "Finance Mart"
}
],
"downstream_dependencies": [
{
"integration_name": "MyParadimeIntegration",
"node_type": "Dashboard",
"node_name": "Finance Daily Report"
}
]
}
},
{
"name": "Finance Daily Report",
"node_type": "Dashboard",
"attributes": {
"description": "This is my first dashboard"
},
"lineage": {
"upstream_dependencies": [],
"downstream_dependencies": []
}
}
]# First party modules
import json
from pathlib import Path
from typing import List
from paradime import Paradime
from paradime.apis.custom_integration.types import Node, NodeType
from paradime.tools.pydantic import parse_obj_as
# Create a Paradime client with your API credentials
paradime = Paradime(api_endpoint="API_ENDPOINT", api_key="API_KEY", api_secret="API_SECRET")
# Load node types and nodes from JSON files
node_types = parse_obj_as(List[NodeType], json.loads(Path("node_types.json").read_text()))
nodes = parse_obj_as(List[Node], json.loads(Path("nodes.json").read_text()))
# Create a custom integration or update it if it already exists
my_integration = paradime.custom_integration.upsert(
name="MyParadimeIntegration",
logo_url="https://example.com/logo.png", # Optional, replace with the logo URL of the integration, or remove this line.
node_types=node_types,
)
# Add nodes to the custom integration.
paradime.custom_integration.add_nodes(
integration_uid=my_integration.uid,
nodes=nodes,
)