PUT /v1/tables/{id}/joins
from datetime import date
from metadata.sdk import configure, client
configure(
host="https://your-company.open-metadata.org/api",
jwt_token="your-jwt-token"
)
rest = client().ometa.client
table_id = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
# Add join information
rest.put(f"/tables/{table_id}/joins", json={
"startDate": date.today().isoformat(),
"dayCount": 1,
"columnJoins": [
{
"columnName": "id",
"joinedWith": [
{
"fullyQualifiedName": "snowflake_prod.analytics.public.orders.customer_id",
"joinCount": 1542
}
]
}
]
})
# Set data model
rest.put(f"/tables/{table_id}/dataModel", json={
"modelType": "DBT",
"description": "Customer dimension table built from raw events",
"sql": "SELECT id, name, email, created_at FROM raw.customers WHERE active = true",
"columns": [
{"name": "id", "dataType": "INT", "description": "Primary key from source"},
{"name": "name", "dataType": "VARCHAR", "description": "Customer full name"},
{"name": "email", "dataType": "VARCHAR", "description": "Verified email address"},
{"name": "created_at", "dataType": "TIMESTAMP", "description": "First seen timestamp"}
]
})
import java.time.LocalDate;
import java.util.List;
import org.openmetadata.schema.type.ColumnJoin;
import org.openmetadata.schema.type.DataModel;
import org.openmetadata.schema.type.JoinedWith;
import org.openmetadata.schema.type.TableJoins;
// client is an initialized OpenMetadataClient.
String tableId = "a1b2c3d4-e5f6-7890-abcd-ef1234567890";
// Add join information
TableJoins joins = new TableJoins()
.withStartDate(LocalDate.now().toString())
.withDayCount(1)
.withColumnJoins(List.of(
new ColumnJoin()
.withColumnName("id")
.withJoinedWith(List.of(
new JoinedWith()
.withFullyQualifiedName("snowflake_prod.analytics.public.orders.customer_id")
.withJoinCount(1542)
))
));
client.tables().updateJoins(tableId, joins);
// Set data model
DataModel dataModel = new DataModel()
.withModelType(DataModel.ModelType.DBT)
.withDescription("Customer dimension table built from raw events")
.withSql("SELECT id, name, email, created_at FROM raw.customers WHERE active = true");
client.tables().updateDataModel(tableId, dataModel);
# Add join information
curl -X PUT "{base_url}/api/v1/tables/455e3d9d-dbbf-455e-b3be-7191daa825f3/joins" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json" \
-d '{
"startDate": "{start_date}",
"dayCount": 1,
"columnJoins": [
{
"columnName": "agent_id",
"joinedWith": [
{
"fullyQualifiedName": "sample_data.ecommerce_db.shopify.dim_agent.agent_id",
"joinCount": 1542
}
]
}
]
}'
# Set data model
curl -X PUT "{base_url}/api/v1/tables/455e3d9d-dbbf-455e-b3be-7191daa825f3/dataModel" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json" \
-d '{
"modelType": "DBT",
"description": "Agent performance summary built from utilization detail tables",
"sql": "SELECT agent_id, AVG(score) as performance_score FROM raw.agent_scores GROUP BY agent_id"
}'
# Get columns with pagination
curl "{base_url}/api/v1/tables/455e3d9d-dbbf-455e-b3be-7191daa825f3/columns?limit=10&offset=0" \
-H "Authorization: Bearer {access_token}"
{
"startDate": "{start_date}",
"dayCount": 1,
"columnJoins": [
{
"columnName": "agent_id",
"joinedWith": [
{
"fullyQualifiedName": "sample_data.ecommerce_db.shopify.dim_agent.agent_id",
"joinCount": 1542
}
]
}
]
}
Table Relationships
Manage joins, data models, columns, and entity relationships for tables
PUT
/
v1
/
tables
/
{id}
/
joins
PUT /v1/tables/{id}/joins
from datetime import date
from metadata.sdk import configure, client
configure(
host="https://your-company.open-metadata.org/api",
jwt_token="your-jwt-token"
)
rest = client().ometa.client
table_id = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
# Add join information
rest.put(f"/tables/{table_id}/joins", json={
"startDate": date.today().isoformat(),
"dayCount": 1,
"columnJoins": [
{
"columnName": "id",
"joinedWith": [
{
"fullyQualifiedName": "snowflake_prod.analytics.public.orders.customer_id",
"joinCount": 1542
}
]
}
]
})
# Set data model
rest.put(f"/tables/{table_id}/dataModel", json={
"modelType": "DBT",
"description": "Customer dimension table built from raw events",
"sql": "SELECT id, name, email, created_at FROM raw.customers WHERE active = true",
"columns": [
{"name": "id", "dataType": "INT", "description": "Primary key from source"},
{"name": "name", "dataType": "VARCHAR", "description": "Customer full name"},
{"name": "email", "dataType": "VARCHAR", "description": "Verified email address"},
{"name": "created_at", "dataType": "TIMESTAMP", "description": "First seen timestamp"}
]
})
import java.time.LocalDate;
import java.util.List;
import org.openmetadata.schema.type.ColumnJoin;
import org.openmetadata.schema.type.DataModel;
import org.openmetadata.schema.type.JoinedWith;
import org.openmetadata.schema.type.TableJoins;
// client is an initialized OpenMetadataClient.
String tableId = "a1b2c3d4-e5f6-7890-abcd-ef1234567890";
// Add join information
TableJoins joins = new TableJoins()
.withStartDate(LocalDate.now().toString())
.withDayCount(1)
.withColumnJoins(List.of(
new ColumnJoin()
.withColumnName("id")
.withJoinedWith(List.of(
new JoinedWith()
.withFullyQualifiedName("snowflake_prod.analytics.public.orders.customer_id")
.withJoinCount(1542)
))
));
client.tables().updateJoins(tableId, joins);
// Set data model
DataModel dataModel = new DataModel()
.withModelType(DataModel.ModelType.DBT)
.withDescription("Customer dimension table built from raw events")
.withSql("SELECT id, name, email, created_at FROM raw.customers WHERE active = true");
client.tables().updateDataModel(tableId, dataModel);
# Add join information
curl -X PUT "{base_url}/api/v1/tables/455e3d9d-dbbf-455e-b3be-7191daa825f3/joins" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json" \
-d '{
"startDate": "{start_date}",
"dayCount": 1,
"columnJoins": [
{
"columnName": "agent_id",
"joinedWith": [
{
"fullyQualifiedName": "sample_data.ecommerce_db.shopify.dim_agent.agent_id",
"joinCount": 1542
}
]
}
]
}'
# Set data model
curl -X PUT "{base_url}/api/v1/tables/455e3d9d-dbbf-455e-b3be-7191daa825f3/dataModel" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json" \
-d '{
"modelType": "DBT",
"description": "Agent performance summary built from utilization detail tables",
"sql": "SELECT agent_id, AVG(score) as performance_score FROM raw.agent_scores GROUP BY agent_id"
}'
# Get columns with pagination
curl "{base_url}/api/v1/tables/455e3d9d-dbbf-455e-b3be-7191daa825f3/columns?limit=10&offset=0" \
-H "Authorization: Bearer {access_token}"
{
"startDate": "{start_date}",
"dayCount": 1,
"columnJoins": [
{
"columnName": "agent_id",
"joinedWith": [
{
"fullyQualifiedName": "sample_data.ecommerce_db.shopify.dim_agent.agent_id",
"joinCount": 1542
}
]
}
]
}
Table Relationships
Manage join information, data models, column listings, and entity relationships for tables.Add Joins
PUT /v1/tables/{id}/joins
Record join information between this table and other tables.
string
required
UUID of the table.
string
required
Start date for the join period (ISO 8601 format). The period must fall within the past 30 days, ending today. In the examples,
{start_date} stands for a date in this range, such as today’s date.integer
Number of days the join data covers.
array
required
Array of column join records.
Set Data Model
PUT /v1/tables/{id}/dataModel
Set the data model (dbt or similar) associated with this table.
string
required
UUID of the table.
string
required
Type of data model:
DBT or DDL.string
Description from the data model.
string
SQL query or transformation logic from the model.
array
Column descriptions and metadata from the data model. Each column needs a
name and a dataType.Get Columns
GET /v1/tables/{id}/columns
Retrieve column information with optional pagination.
string
required
UUID of the table.
integer
default:"10"
Maximum number of columns to return.
integer
default:"0"
Offset for pagination.
PUT /v1/tables/{id}/joins
from datetime import date
from metadata.sdk import configure, client
configure(
host="https://your-company.open-metadata.org/api",
jwt_token="your-jwt-token"
)
rest = client().ometa.client
table_id = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
# Add join information
rest.put(f"/tables/{table_id}/joins", json={
"startDate": date.today().isoformat(),
"dayCount": 1,
"columnJoins": [
{
"columnName": "id",
"joinedWith": [
{
"fullyQualifiedName": "snowflake_prod.analytics.public.orders.customer_id",
"joinCount": 1542
}
]
}
]
})
# Set data model
rest.put(f"/tables/{table_id}/dataModel", json={
"modelType": "DBT",
"description": "Customer dimension table built from raw events",
"sql": "SELECT id, name, email, created_at FROM raw.customers WHERE active = true",
"columns": [
{"name": "id", "dataType": "INT", "description": "Primary key from source"},
{"name": "name", "dataType": "VARCHAR", "description": "Customer full name"},
{"name": "email", "dataType": "VARCHAR", "description": "Verified email address"},
{"name": "created_at", "dataType": "TIMESTAMP", "description": "First seen timestamp"}
]
})
import java.time.LocalDate;
import java.util.List;
import org.openmetadata.schema.type.ColumnJoin;
import org.openmetadata.schema.type.DataModel;
import org.openmetadata.schema.type.JoinedWith;
import org.openmetadata.schema.type.TableJoins;
// client is an initialized OpenMetadataClient.
String tableId = "a1b2c3d4-e5f6-7890-abcd-ef1234567890";
// Add join information
TableJoins joins = new TableJoins()
.withStartDate(LocalDate.now().toString())
.withDayCount(1)
.withColumnJoins(List.of(
new ColumnJoin()
.withColumnName("id")
.withJoinedWith(List.of(
new JoinedWith()
.withFullyQualifiedName("snowflake_prod.analytics.public.orders.customer_id")
.withJoinCount(1542)
))
));
client.tables().updateJoins(tableId, joins);
// Set data model
DataModel dataModel = new DataModel()
.withModelType(DataModel.ModelType.DBT)
.withDescription("Customer dimension table built from raw events")
.withSql("SELECT id, name, email, created_at FROM raw.customers WHERE active = true");
client.tables().updateDataModel(tableId, dataModel);
# Add join information
curl -X PUT "{base_url}/api/v1/tables/455e3d9d-dbbf-455e-b3be-7191daa825f3/joins" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json" \
-d '{
"startDate": "{start_date}",
"dayCount": 1,
"columnJoins": [
{
"columnName": "agent_id",
"joinedWith": [
{
"fullyQualifiedName": "sample_data.ecommerce_db.shopify.dim_agent.agent_id",
"joinCount": 1542
}
]
}
]
}'
# Set data model
curl -X PUT "{base_url}/api/v1/tables/455e3d9d-dbbf-455e-b3be-7191daa825f3/dataModel" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json" \
-d '{
"modelType": "DBT",
"description": "Agent performance summary built from utilization detail tables",
"sql": "SELECT agent_id, AVG(score) as performance_score FROM raw.agent_scores GROUP BY agent_id"
}'
# Get columns with pagination
curl "{base_url}/api/v1/tables/455e3d9d-dbbf-455e-b3be-7191daa825f3/columns?limit=10&offset=0" \
-H "Authorization: Bearer {access_token}"
{
"startDate": "{start_date}",
"dayCount": 1,
"columnJoins": [
{
"columnName": "agent_id",
"joinedWith": [
{
"fullyQualifiedName": "sample_data.ecommerce_db.shopify.dim_agent.agent_id",
"joinCount": 1542
}
]
}
]
}
Returns
Add joins returns the join data associated with the table. Set data model returns the updated table with data model attached. Get columns returns a paginated list of column definitions.Error Handling
| Code | Error Type | Description |
|---|---|---|
401 | UNAUTHORIZED | Invalid or missing authentication token |
403 | FORBIDDEN | User lacks permission |
404 | NOT_FOUND | Table does not exist |
400 | BAD_REQUEST | Invalid join data or data model format |
Was this page helpful?