catalog_data_source.

scan_sql

scan_sql(data_source_id: str, sql_request: ScanSqlRequest)

Analyze SELECT SQL query in a given request. Return description of SQL result-set as list of column names with GoodData data types and list of example data returned by SELECT query.

Parameters

nametypedescription
data_source_idstringData source identification string. e.g. "demo"
sql_requestScanSqlRequestSELECT SQL query to analyze.

Returns

typedescription
ScanSqlResponseSELECT query analysis result.

Example

# Scan sql
sdk.catalog_data_source.scan_sql(data_source_id="123", sql_request=ScanSqlRequest(sql="SELECT * FROM products"))
# ScanSqlResponse(
#   columns=[
#       ScanSqlColumn(data_type='STRING', name='category'),
#       ScanSqlColumn(data_type='INT', name='product_id'),
#       ScanSqlColumn(data_type='STRING', name='product_name')]
#   ],
#   data_preview=[
#       ['150', 'Skirt', 'Clothing'],
#       ['210', 'Artego', 'Electronics'],
#       ...
#   ]
#)