diff --git a/gooddata-api-client/docs/ActionsApi.md b/gooddata-api-client/docs/ActionsApi.md index 04e38060e..f55dd8294 100644 --- a/gooddata-api-client/docs/ActionsApi.md +++ b/gooddata-api-client/docs/ActionsApi.md @@ -4214,6 +4214,7 @@ with gooddata_api_client.ApiClient() as api_client: data_type="INT", description="Customer unique identifier", name="customer_id", + null_value="null_value_example", ), ], statement="select * from abc", @@ -4242,6 +4243,7 @@ with gooddata_api_client.ApiClient() as api_client: is_nullable=True, is_primary_key=True, name="customer_id", + null_value="null_value_example", referenced_table_column="customer_id", referenced_table_id="customers", ), diff --git a/gooddata-api-client/docs/DeclarativeColumn.md b/gooddata-api-client/docs/DeclarativeColumn.md index 57c43dc06..bbd7b29d3 100644 --- a/gooddata-api-client/docs/DeclarativeColumn.md +++ b/gooddata-api-client/docs/DeclarativeColumn.md @@ -10,6 +10,7 @@ Name | Type | Description | Notes **description** | **str** | Column description/comment from database | [optional] **is_nullable** | **bool** | Column is nullable | [optional] **is_primary_key** | **bool** | Is column part of primary key? | [optional] +**null_value** | **str** | Value used as sentinel for nullable columns | [optional] **referenced_table_column** | **str** | Referenced table (Foreign key) | [optional] **referenced_table_id** | **str** | Referenced table (Foreign key) | [optional] **any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] diff --git a/gooddata-api-client/docs/GenerateLogicalDataModelApi.md b/gooddata-api-client/docs/GenerateLogicalDataModelApi.md index bb8f71be1..84aa0cc43 100644 --- a/gooddata-api-client/docs/GenerateLogicalDataModelApi.md +++ b/gooddata-api-client/docs/GenerateLogicalDataModelApi.md @@ -55,6 +55,7 @@ with gooddata_api_client.ApiClient() as api_client: data_type="INT", description="Customer unique identifier", name="customer_id", + null_value="null_value_example", ), ], statement="select * from abc", @@ -83,6 +84,7 @@ with gooddata_api_client.ApiClient() as api_client: is_nullable=True, is_primary_key=True, name="customer_id", + null_value="null_value_example", referenced_table_column="customer_id", referenced_table_id="customers", ), diff --git a/gooddata-api-client/docs/SqlColumn.md b/gooddata-api-client/docs/SqlColumn.md index 0c4a5b92d..306bce158 100644 --- a/gooddata-api-client/docs/SqlColumn.md +++ b/gooddata-api-client/docs/SqlColumn.md @@ -8,6 +8,7 @@ Name | Type | Description | Notes **data_type** | **str** | Column type | **name** | **str** | Column name | **description** | **str** | Column description/comment from database | [optional] +**null_value** | **str** | Value used as sentinel for null values in the column | [optional] **any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/gooddata-api-client/gooddata_api_client/model/declarative_column.py b/gooddata-api-client/gooddata_api_client/model/declarative_column.py index fccfe03ee..71c8293de 100644 --- a/gooddata-api-client/gooddata_api_client/model/declarative_column.py +++ b/gooddata-api-client/gooddata_api_client/model/declarative_column.py @@ -109,6 +109,7 @@ def openapi_types(): 'description': (str,), # noqa: E501 'is_nullable': (bool,), # noqa: E501 'is_primary_key': (bool,), # noqa: E501 + 'null_value': (str,), # noqa: E501 'referenced_table_column': (str,), # noqa: E501 'referenced_table_id': (str,), # noqa: E501 } @@ -124,6 +125,7 @@ def discriminator(): 'description': 'description', # noqa: E501 'is_nullable': 'isNullable', # noqa: E501 'is_primary_key': 'isPrimaryKey', # noqa: E501 + 'null_value': 'nullValue', # noqa: E501 'referenced_table_column': 'referencedTableColumn', # noqa: E501 'referenced_table_id': 'referencedTableId', # noqa: E501 } @@ -176,6 +178,7 @@ def _from_openapi_data(cls, data_type, name, *args, **kwargs): # noqa: E501 description (str): Column description/comment from database. [optional] # noqa: E501 is_nullable (bool): Column is nullable. [optional] # noqa: E501 is_primary_key (bool): Is column part of primary key?. [optional] # noqa: E501 + null_value (str): Value used as sentinel for nullable columns. [optional] # noqa: E501 referenced_table_column (str): Referenced table (Foreign key). [optional] # noqa: E501 referenced_table_id (str): Referenced table (Foreign key). [optional] # noqa: E501 """ @@ -272,6 +275,7 @@ def __init__(self, data_type, name, *args, **kwargs): # noqa: E501 description (str): Column description/comment from database. [optional] # noqa: E501 is_nullable (bool): Column is nullable. [optional] # noqa: E501 is_primary_key (bool): Is column part of primary key?. [optional] # noqa: E501 + null_value (str): Value used as sentinel for nullable columns. [optional] # noqa: E501 referenced_table_column (str): Referenced table (Foreign key). [optional] # noqa: E501 referenced_table_id (str): Referenced table (Foreign key). [optional] # noqa: E501 """ diff --git a/gooddata-api-client/gooddata_api_client/model/sql_column.py b/gooddata-api-client/gooddata_api_client/model/sql_column.py index 399b1e961..5dc075249 100644 --- a/gooddata-api-client/gooddata_api_client/model/sql_column.py +++ b/gooddata-api-client/gooddata_api_client/model/sql_column.py @@ -95,6 +95,7 @@ def openapi_types(): 'data_type': (str,), # noqa: E501 'name': (str,), # noqa: E501 'description': (str,), # noqa: E501 + 'null_value': (str,), # noqa: E501 } @cached_property @@ -106,6 +107,7 @@ def discriminator(): 'data_type': 'dataType', # noqa: E501 'name': 'name', # noqa: E501 'description': 'description', # noqa: E501 + 'null_value': 'nullValue', # noqa: E501 } read_only_vars = { @@ -154,6 +156,7 @@ def _from_openapi_data(cls, data_type, name, *args, **kwargs): # noqa: E501 through its discriminator because we passed in _visited_composed_classes = (Animal,) description (str): Column description/comment from database. [optional] # noqa: E501 + null_value (str): Value used as sentinel for null values in the column. [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) @@ -246,6 +249,7 @@ def __init__(self, data_type, name, *args, **kwargs): # noqa: E501 through its discriminator because we passed in _visited_composed_classes = (Animal,) description (str): Column description/comment from database. [optional] # noqa: E501 + null_value (str): Value used as sentinel for null values in the column. [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) diff --git a/packages/gooddata-sdk/src/gooddata_sdk/catalog/data_source/action_model/sql_column.py b/packages/gooddata-sdk/src/gooddata_sdk/catalog/data_source/action_model/sql_column.py index 781273509..b7bfd8f1d 100644 --- a/packages/gooddata-sdk/src/gooddata_sdk/catalog/data_source/action_model/sql_column.py +++ b/packages/gooddata-sdk/src/gooddata_sdk/catalog/data_source/action_model/sql_column.py @@ -11,6 +11,7 @@ class SqlColumn(Base): data_type: str name: str + null_value: str | None = None @staticmethod def client_class() -> type[ApiSqlColumn]: diff --git a/packages/gooddata-sdk/tests/catalog/fixtures/data_sources/scan_scan_sql_without_preview.yaml b/packages/gooddata-sdk/tests/catalog/fixtures/data_sources/scan_scan_sql_without_preview.yaml index 8678a8710..aeaa4c781 100644 --- a/packages/gooddata-sdk/tests/catalog/fixtures/data_sources/scan_scan_sql_without_preview.yaml +++ b/packages/gooddata-sdk/tests/catalog/fixtures/data_sources/scan_scan_sql_without_preview.yaml @@ -22,6 +22,7 @@ interactions: columns: - dataType: INT name: campaign_id + nullValue: '0' headers: Content-Type: - application/json diff --git a/packages/gooddata-sdk/tests/catalog/fixtures/data_sources/scan_sql.yaml b/packages/gooddata-sdk/tests/catalog/fixtures/data_sources/scan_sql.yaml index 489a8cb76..b05d2b791 100644 --- a/packages/gooddata-sdk/tests/catalog/fixtures/data_sources/scan_sql.yaml +++ b/packages/gooddata-sdk/tests/catalog/fixtures/data_sources/scan_sql.yaml @@ -22,10 +22,13 @@ interactions: columns: - dataType: INT name: product_id + nullValue: '0' - dataType: STRING name: product_name + nullValue: _ - dataType: STRING name: category + nullValue: _ dataPreview: - - '150' - Skirt diff --git a/packages/gooddata-sdk/tests/catalog/fixtures/data_sources/scan_sql_with_nulls_in_preview.yaml b/packages/gooddata-sdk/tests/catalog/fixtures/data_sources/scan_sql_with_nulls_in_preview.yaml index 125e68a91..7164a960f 100644 --- a/packages/gooddata-sdk/tests/catalog/fixtures/data_sources/scan_sql_with_nulls_in_preview.yaml +++ b/packages/gooddata-sdk/tests/catalog/fixtures/data_sources/scan_sql_with_nulls_in_preview.yaml @@ -23,6 +23,7 @@ interactions: columns: - dataType: INT name: campaign_id + nullValue: '0' dataPreview: - - null - - null diff --git a/packages/gooddata-sdk/tests/catalog/test_catalog_data_source.py b/packages/gooddata-sdk/tests/catalog/test_catalog_data_source.py index e6586450d..efc1d85be 100644 --- a/packages/gooddata-sdk/tests/catalog/test_catalog_data_source.py +++ b/packages/gooddata-sdk/tests/catalog/test_catalog_data_source.py @@ -728,9 +728,9 @@ def test_scan_sql(test_config: dict): assert len(response.columns) == 3 assert response.columns == [ - SqlColumn(name="category", data_type="STRING"), - SqlColumn(name="product_id", data_type="INT"), - SqlColumn(name="product_name", data_type="STRING"), + SqlColumn(name="category", data_type="STRING", null_value="_"), + SqlColumn(name="product_id", data_type="INT", null_value="0"), + SqlColumn(name="product_name", data_type="STRING", null_value="_"), ] assert len(response.data_preview) == 10 @@ -746,7 +746,7 @@ def test_scan_sql_with_nulls_in_preview(test_config: dict): assert len(response.columns) == 1 assert response.columns == [ - SqlColumn(name="campaign_id", data_type="INT"), + SqlColumn(name="campaign_id", data_type="INT", null_value="0"), ] assert len(response.data_preview) == 5 assert [None] in response.data_preview @@ -763,7 +763,7 @@ def test_scan_sql_without_preview(test_config: dict): assert len(response.columns) == 1 assert response.columns == [ - SqlColumn(name="campaign_id", data_type="INT"), + SqlColumn(name="campaign_id", data_type="INT", null_value="0"), ] assert response.data_preview is None diff --git a/schemas/gooddata-api-client.json b/schemas/gooddata-api-client.json index 65bb11271..f9539d0fe 100644 --- a/schemas/gooddata-api-client.json +++ b/schemas/gooddata-api-client.json @@ -5836,6 +5836,10 @@ "maxLength": 255, "type": "string" }, + "nullValue": { + "description": "Value used as sentinel for nullable columns", + "type": "string" + }, "referencedTableColumn": { "description": "Referenced table (Foreign key)", "example": "customer_id", @@ -34017,6 +34021,10 @@ "description": "Column name", "example": "customer_id", "type": "string" + }, + "nullValue": { + "description": "Value used as sentinel for null values in the column", + "type": "string" } }, "required": [ diff --git a/schemas/gooddata-scan-client.json b/schemas/gooddata-scan-client.json index e2615e8dc..b3c702792 100644 --- a/schemas/gooddata-scan-client.json +++ b/schemas/gooddata-scan-client.json @@ -239,6 +239,10 @@ "maxLength": 255, "type": "string" }, + "nullValue": { + "description": "Value used as sentinel for nullable columns", + "type": "string" + }, "referencedTableColumn": { "description": "Referenced table (Foreign key)", "example": "customer_id", @@ -544,6 +548,10 @@ "description": "Column name", "example": "customer_id", "type": "string" + }, + "nullValue": { + "description": "Value used as sentinel for null values in the column", + "type": "string" } }, "required": [