Get external table structure
Gets the description structure of the external table of the request
- Parameters
- Advanced call ?
Function GetExternalTableStructure(Val Name, Val ColoumnsStruct, Val Data = Undefined, Val DataFormat = Undefined) Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| Name | --name | String | ✔ | Table name |
| ColoumnsStruct | --cols | Structure Of KeyAndValue | ✔ | Table column structure: Key > name, Value > data type |
| Data | --data | Arbitrary | ✖ | String, file, or binary data of the table |
| DataFormat | --format | String | ✖ | Data format: CVS, TVS, JSON, etc.. |
Returns
Structure Of KeyAndValue - Structure of external table description
| Parameter | Description |
|---|---|
| dontwait | Creates a background job and returns its data (for 1C and OneScript only) |
1C:Enterprise/OneScript code example
// Minimal structure
TableName = "external_data";
ColoumnsStruct = New Structure;
ColoumnsStruct.Insert("id" , "UInt64");
ColoumnsStruct.Insert("name", "String");
Result = OPI_ClickHouse.GetExternalTableStructure(TableName, ColoumnsStruct);
// With TSV data
TableData = StrTemplate("1%1Test
|2%1Test2", Chars.Tab);
Result = OPI_ClickHouse.GetExternalTableStructure(TableName, ColoumnsStruct, TableData, "TSV");
- Bash
- CMD/Bat
# JSON data can also be passed as a path to a .json file
oint clickhouse GetExternalTableStructure \
--name "ext_grpc" \
--cols "{'id':'UInt64','name':'String'}" \
--data "1 John\n2 Jane" \
--format "TSV"
:: JSON data can also be passed as a path to a .json file
oint clickhouse GetExternalTableStructure ^
--name "ext_grpc" ^
--cols "{'id':'UInt64','name':'String'}" ^
--data "1 John\n2 Jane" ^
--format "TSV"
Result
{
"name": "external_data",
"cols": {
"id": "UInt64",
"name": "String"
},
"data": "1\tTest\n2\tTest2",
"format": "TSV"
}