This documentation is for an older version of GoodData.
Go to the latest version of this article.
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
name | type | description |
---|---|---|
data_source_id | string | Data source identification string. e.g. "demo" |
sql_request | ScanSqlRequest | SELECT SQL query to analyze. |
Returns
type | description |
---|---|
ScanSqlResponse | SELECT 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'],
# ...
# ]
#)