CreateDataPackageTable - POST
|
Path |
/api/projects/{projectId}/metavault/sourcesystems/{sourceId}/datapackages/{dataPackageId}/tables |
|---|---|
|
Http Method |
POST |
Overview
Create a data package table by either:
-
Specifying a literal creation query.
-
For a table: the literal list of columns.
-
For a view: the literal select query, used as the code to generate the query.
-
-
Specifying a list of columns.
Hard rules are not defined using this call. They must be applied after the table creation individually on columns using: Metavault API - Update data package table column (hard rule)
Required permissions
-
Write access to the Source module. BUILD WRITE
Request
Path parameters
|
Parameter |
Type |
Required |
Description |
Example |
|---|---|---|---|---|
|
sourceId |
string |
Yes |
The Id of the source system in which we want to create a table. |
318417de-8022-4e04-a2e7-37014d420232 |
|
dataPackageId |
string |
Yes |
The Id of the data package in which we want to create a table. |
eb236f68-1ec8-4cc4-ac1d-ce02358cac61 |
Request body
{
"query": "",
"queryType": "Table",
"tableName": "myso01_mydatapackage1",
"columns": [
{
"name": "column1",
"dataType": "String",
"dataTypeCustom": null,
"nullable": false,
"primaryKey": true,
"businessDescription": "",
"businessName": "",
"technicalDescription": "",
"length": 255,
"precision": null,
"scale": null
},
{
"name": "column2",
"dataType": "String",
"dataTypeCustom": null,
"nullable": true,
"primaryKey": false,
"businessDescription": "",
"businessName": "",
"technicalDescription": "",
"length": 50,
"precision": null,
"scale": null
},
{
"name": "column3",
"dataType": "String",
"dataTypeCustom": null,
"nullable": true,
"primaryKey": false,
"businessDescription": "",
"businessName": "",
"technicalDescription": "",
"length": 10,
"precision": null,
"scale": null
}
]
}
Field descriptions
|
Field |
Type |
Required |
Description |
Constraints |
|---|---|---|---|---|
|
tableName |
string |
Yes |
The name of the table in the database. |
|
|
query |
string |
No |
The literal SQL query ot create the table or the view.
|
For a table: SQL
For a view: SQL
|
|
queryType |
String literal: |
If |
|
|
|
columns |
Array of objects |
If |
The list of columns in a table that is explicitly defined. |
|
|
columns.name |
string |
Yes |
The name of the column in the database. |
|
|
columns.businessName |
string |
Yes |
The business name of the column. A user-friendly name. |
|
|
columns.primaryKey |
boolean |
Yes |
If this is true, this column will be considered as the primary key of the table. |
|
|
columns.nullable |
boolean |
Yes |
True if the column is nullable. False if not. |
|
|
columns.dataType |
string |
Yes |
7.0.0 The name of the type of the column. This is one of .NET’s Starting with 7.0.0 , see: Metavault API - General concepts | Column types |
|
|
columns.dataTypeCustom |
string |
No |
Starting with 7.0.0 , see: Metavault API - General concepts | Column types |
|
|
columns.length |
integer |
No |
Length of the column. Starting with 7.0.0 , see: Metavault API - General concepts | Column types |
|
|
columns.precision |
integer |
No |
Precision of the column. Starting with 7.0.0 , see: Metavault API - General concepts | Column types |
|
|
columns.scale |
integer |
No |
Scale of the column. Starting with 7.0.0 , see: Metavault API - General concepts | Column types |
|
|
columns.technicalDescription |
string |
No |
A description of the column aimed at technical profiles. |
|
|
columns.businessDescription |
string |
No |
A description of the column aimed at business profiles. |
|
Response
Success response (200 OK)
Before 7.0.0 :
{
"_embedded": {
"columns": [
{
"id": "df84cf1a9690437894fa6f5506344167",
"name": "column1",
"dataType": "String",
"length": 255,
"baseType": {
"isText": true,
"isBinary": false,
"type": "String",
"dataType": "String",
"length": 255,
"autoIncrement": false
},
"nullable": false,
"technicalDescription": "",
"businessDescription": "",
"businessName": "",
"primaryKey": true,
"typeFullName": "VARCHAR(255)"
},
{
"id": "eb44fb54f6cb4198a06d546da230cb19",
"name": "column2",
"dataType": "String",
"length": 50,
"baseType": {
"isText": true,
"isBinary": false,
"type": "String",
"dataType": "String",
"length": 50,
"autoIncrement": false
},
"nullable": true,
"technicalDescription": "",
"businessDescription": "",
"businessName": "",
"primaryKey": false,
"typeFullName": "VARCHAR(50)"
},
{
"id": "ed64872843064b60845561bbc1d42059",
"name": "column3",
"dataType": "String",
"length": 10,
"baseType": {
"isText": true,
"isBinary": false,
"type": "String",
"dataType": "String",
"length": 10,
"autoIncrement": false
},
"nullable": true,
"technicalDescription": "",
"businessDescription": "",
"businessName": "",
"primaryKey": false,
"typeFullName": "VARCHAR(10)"
}
]
},
"id": "23973d8d0fea47bf8e45d991dbc33d5f",
"tableName": "myso01_mydatapackage1",
"targetTableName": "myso01_mydatapackage1",
"targetSchemaName": "stg",
"sourceSystemId": "3c24b0fb-a999-48e9-9b41-209412a47df3",
"dataPackageId": "ca761ccf-1cbd-4d5f-92ca-bccef1c5deda",
"query": "",
"queryType": "Table",
"isQueryBased": false
}
Starting from 7.0.0 (new column/HR types definitions respect the formalism defined in Metavault API - General concepts | Column types):
{
"_embedded": {
"columns": [
{
"id": "df84cf1a9690437894fa6f5506344167",
"name": "column1",
"businessName": "column1",
"technicalDescription": "",
"businessDescription": "",
"nullable": false,
"primaryKey": true,
"dataType": "String",
"dataTypeCustom": null,
"length": 255,
"precision": null,
"scale": null,
"typeFullName": "VARCHAR(255)",
"baseDataType": "String",
"baseDataTypeCustom": null,
"baseLength": 255,
"basePrecision": null,
"baseScale": null,
"baseTypeFullName": "VARCHAR(255)",
"hardRuleDataType": null,
"hardRuleDataTypeCustom": null,
"hardRuleLength": null,
"hardRulePrecision": null,
"hardRuleScale": null,
"hardRuleTypeFullName": null
},
{
"id": "eb44fb54f6cb4198a06d546da230cb19",
"name": "column2",
"businessName": "column2",
"technicalDescription": "",
"businessDescription": "",
"nullable": true,
"primaryKey": false,
"dataType": "String",
"dataTypeCustom": null,
"length": 50,
"precision": null,
"scale": null,
"typeFullName": "VARCHAR(50)",
"baseDataType": "String",
"baseDataTypeCustom": null,
"baseLength": 50,
"basePrecision": null,
"baseScale": null,
"baseTypeFullName": "VARCHAR(50)",
"hardRuleDataType": null,
"hardRuleDataTypeCustom": null,
"hardRuleLength": null,
"hardRulePrecision": null,
"hardRuleScale": null,
"hardRuleTypeFullName": null
},
{
"id": "ed64872843064b60845561bbc1d42059",
"name": "column3",
"businessName": "column3",
"technicalDescription": "",
"businessDescription": "",
"nullable": true,
"primaryKey": false,
"dataType": "String",
"dataTypeCustom": null,
"length": 10,
"precision": null,
"scale": null,
"typeFullName": "VARCHAR(10)",
"baseDataType": "String",
"baseDataTypeCustom": null,
"baseLength": 10,
"basePrecision": null,
"baseScale": null,
"baseTypeFullName": "VARCHAR(10)",
"hardRuleDataType": null,
"hardRuleDataTypeCustom": null,
"hardRuleLength": null,
"hardRulePrecision": null,
"hardRuleScale": null,
"hardRuleTypeFullName": null
}
]
},
"id": "23973d8d0fea47bf8e45d991dbc33d5f",
"tableName": "myso01_mydatapackage1",
"targetTableName": "myso01_mydatapackage1",
"targetSchemaName": "stg",
"sourceSystemId": "3c24b0fb-a999-48e9-9b41-209412a47df3",
"dataPackageId": "ca761ccf-1cbd-4d5f-92ca-bccef1c5deda",
"query": "",
"queryType": "Table",
"isQueryBased": false
}
Response fields
Starting from 7.0.0 (new column/HR types definitions respect the formalism defined in (Metavault API - General concepts | Column types):
|
Field |
Type |
Description |
|---|---|---|
|
id |
string |
The id of the table, generated by the app. |
|
tableName |
string |
The name of the table in the database. |
|
targetTableName |
string |
Also the name of the table in the database, but after applying eventual naming conventions. This will be used to generate the final name in the database. Typically it is the same as |
|
targetSchemaName |
string |
The name of the schema of the datapackage table. |
|
sourceSystemId |
string |
The id of the source system in which the table is. |
|
dataPackageId |
string |
The id of the data package in which the table is. |
|
query |
string |
If the table is query-based, the query. |
|
queryType |
string |
Either |
|
isQueryBased |
boolean |
True if the table is query-based, false if it isn’t. |
|
_embedded.columns |
Array of objects |
The list of the columns in the table. |
|
_embedded.columns.id |
string |
The id of the column. |
|
_embedded.columns.name |
string |
The name of the column in the database. |
|
_embedded.columns.businessName |
string |
The user-friendly business name of the column. |
|
_embedded.columns.technicalDescription |
string |
The description of the column, as a technical profile would provide it. |
|
_embedded.columns.businessDescription |
string |
The description of the column, as a business profile would provide it. |
|
_embedded.columns.nullable |
boolean |
Whether or not the column is nullable. |
|
_embedded.columns.primaryKey |
boolean |
Whether or not the column is the primary key. |
|
_embedded.columns.hardRuleDefinition |
string |
If the column has a hard rule this is set to the hard rule to apply to the underlying data when moving the data from L1 to L2 staging tables. If this is NULL, there is no hard rule. In the text SQL expression the column name reference is represented by two curly brackets: |
|
_embedded.columns.dataType |
string |
If there is a hard rule: |
|
_embedded.columns.dataTypeCustom |
string |
If there is a hard rule: |
|
_embedded.columns.length |
integer |
If there is a hard rule: |
|
_embedded.columns.precision |
integer |
If there is a hard rule: |
|
_embedded.columns.scale |
integer |
If there is a hard rule: |
|
_embedded.columns.typeFullName |
string |
If there is a hard rule: |
|
_embedded.columns.baseDataType |
string |
The selected type of the underlying column (without the hard rule).
|
|
_embedded.columns.baseDataTypeCustom |
string |
The custom type string of the underlying column (without the hard rule). |
|
_embedded.columns.baseLength |
integer |
The length of the type of the underlying column (without the hard rule). |
|
_embedded.columns.basePrecision |
integer |
The precision of the type of the underlying column (without the hard rule). |
|
_embedded.columns.baseScale |
integer |
The scale of the type of the underlying column (without the hard rule). |
|
_embedded.columns.baseTypeFullName |
string |
The full name of the type of the underlying column (without the hard rule). |
|
_embedded.columns.hardRuledataType |
string |
The selected type of the hard rule, if there is one. Otherwise, null.
|
|
_embedded.columns.hardRuleDataTypeCustom |
string |
The custom type string of the hard rule, if there is one. Otherwise, null. |
|
_embedded.columns.hardRuleLength |
integer |
The length of the type of the hard rule, if there is one. Otherwise, null. |
|
_embedded.columns.hardRulePrecision |
integer |
The precision of the type of the hard rule, if there is one. Otherwise, null. |
|
_embedded.columns.hardRuleScale |
integer |
The scale of the type of the hard rule, if there is one. Otherwise, null. |
|
_embedded.columns.hardRuleTypeFullName |
string |
The full name of the type of the hard rule, if there is one. Otherwise, null.
|