Skip to main content

Get external table structure

Gets the description structure of the external table of the request

Function GetExternalTableStructure(Val Name, Val ColoumnsStruct, Val Data = Undefined, Val DataFormat = Undefined) Export

ParameterCLI optionTypeRequiredDescription
Name--nameStringTable name
ColoumnsStruct--colsStructure Of KeyAndValueTable column structure: Key > name, Value > data type
Data--dataArbitraryString, file, or binary data of the table
DataFormat--formatStringData format: CVS, TVS, JSON, etc..
Returns

Structure Of KeyAndValue - Structure of external table description

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");
# 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"
}