Skip to content

Commit 95b2cea

Browse files
committed
feat: add null values to pdm and sql scans
JIRA: CQ-2472 risk: low
1 parent 017c555 commit 95b2cea

13 files changed

Lines changed: 41 additions & 5 deletions

File tree

gooddata-api-client/docs/ActionsApi.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4214,6 +4214,7 @@ with gooddata_api_client.ApiClient() as api_client:
42144214
data_type="INT",
42154215
description="Customer unique identifier",
42164216
name="customer_id",
4217+
null_value="null_value_example",
42174218
),
42184219
],
42194220
statement="select * from abc",
@@ -4242,6 +4243,7 @@ with gooddata_api_client.ApiClient() as api_client:
42424243
is_nullable=True,
42434244
is_primary_key=True,
42444245
name="customer_id",
4246+
null_value="null_value_example",
42454247
referenced_table_column="customer_id",
42464248
referenced_table_id="customers",
42474249
),

gooddata-api-client/docs/DeclarativeColumn.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Name | Type | Description | Notes
1010
**description** | **str** | Column description/comment from database | [optional]
1111
**is_nullable** | **bool** | Column is nullable | [optional]
1212
**is_primary_key** | **bool** | Is column part of primary key? | [optional]
13+
**null_value** | **str** | Value used as sentinel for nullable columns | [optional]
1314
**referenced_table_column** | **str** | Referenced table (Foreign key) | [optional]
1415
**referenced_table_id** | **str** | Referenced table (Foreign key) | [optional]
1516
**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]

gooddata-api-client/docs/GenerateLogicalDataModelApi.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ with gooddata_api_client.ApiClient() as api_client:
5555
data_type="INT",
5656
description="Customer unique identifier",
5757
name="customer_id",
58+
null_value="null_value_example",
5859
),
5960
],
6061
statement="select * from abc",
@@ -83,6 +84,7 @@ with gooddata_api_client.ApiClient() as api_client:
8384
is_nullable=True,
8485
is_primary_key=True,
8586
name="customer_id",
87+
null_value="null_value_example",
8688
referenced_table_column="customer_id",
8789
referenced_table_id="customers",
8890
),

gooddata-api-client/docs/SqlColumn.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Name | Type | Description | Notes
88
**data_type** | **str** | Column type |
99
**name** | **str** | Column name |
1010
**description** | **str** | Column description/comment from database | [optional]
11+
**null_value** | **str** | Value used as sentinel for null values in the column | [optional]
1112
**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]
1213

1314
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

gooddata-api-client/gooddata_api_client/model/declarative_column.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ def openapi_types():
109109
'description': (str,), # noqa: E501
110110
'is_nullable': (bool,), # noqa: E501
111111
'is_primary_key': (bool,), # noqa: E501
112+
'null_value': (str,), # noqa: E501
112113
'referenced_table_column': (str,), # noqa: E501
113114
'referenced_table_id': (str,), # noqa: E501
114115
}
@@ -124,6 +125,7 @@ def discriminator():
124125
'description': 'description', # noqa: E501
125126
'is_nullable': 'isNullable', # noqa: E501
126127
'is_primary_key': 'isPrimaryKey', # noqa: E501
128+
'null_value': 'nullValue', # noqa: E501
127129
'referenced_table_column': 'referencedTableColumn', # noqa: E501
128130
'referenced_table_id': 'referencedTableId', # noqa: E501
129131
}
@@ -176,6 +178,7 @@ def _from_openapi_data(cls, data_type, name, *args, **kwargs): # noqa: E501
176178
description (str): Column description/comment from database. [optional] # noqa: E501
177179
is_nullable (bool): Column is nullable. [optional] # noqa: E501
178180
is_primary_key (bool): Is column part of primary key?. [optional] # noqa: E501
181+
null_value (str): Value used as sentinel for nullable columns. [optional] # noqa: E501
179182
referenced_table_column (str): Referenced table (Foreign key). [optional] # noqa: E501
180183
referenced_table_id (str): Referenced table (Foreign key). [optional] # noqa: E501
181184
"""
@@ -272,6 +275,7 @@ def __init__(self, data_type, name, *args, **kwargs): # noqa: E501
272275
description (str): Column description/comment from database. [optional] # noqa: E501
273276
is_nullable (bool): Column is nullable. [optional] # noqa: E501
274277
is_primary_key (bool): Is column part of primary key?. [optional] # noqa: E501
278+
null_value (str): Value used as sentinel for nullable columns. [optional] # noqa: E501
275279
referenced_table_column (str): Referenced table (Foreign key). [optional] # noqa: E501
276280
referenced_table_id (str): Referenced table (Foreign key). [optional] # noqa: E501
277281
"""

gooddata-api-client/gooddata_api_client/model/sql_column.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ def openapi_types():
9595
'data_type': (str,), # noqa: E501
9696
'name': (str,), # noqa: E501
9797
'description': (str,), # noqa: E501
98+
'null_value': (str,), # noqa: E501
9899
}
99100

100101
@cached_property
@@ -106,6 +107,7 @@ def discriminator():
106107
'data_type': 'dataType', # noqa: E501
107108
'name': 'name', # noqa: E501
108109
'description': 'description', # noqa: E501
110+
'null_value': 'nullValue', # noqa: E501
109111
}
110112

111113
read_only_vars = {
@@ -154,6 +156,7 @@ def _from_openapi_data(cls, data_type, name, *args, **kwargs): # noqa: E501
154156
through its discriminator because we passed in
155157
_visited_composed_classes = (Animal,)
156158
description (str): Column description/comment from database. [optional] # noqa: E501
159+
null_value (str): Value used as sentinel for null values in the column. [optional] # noqa: E501
157160
"""
158161

159162
_check_type = kwargs.pop('_check_type', True)
@@ -246,6 +249,7 @@ def __init__(self, data_type, name, *args, **kwargs): # noqa: E501
246249
through its discriminator because we passed in
247250
_visited_composed_classes = (Animal,)
248251
description (str): Column description/comment from database. [optional] # noqa: E501
252+
null_value (str): Value used as sentinel for null values in the column. [optional] # noqa: E501
249253
"""
250254

251255
_check_type = kwargs.pop('_check_type', True)

packages/gooddata-sdk/src/gooddata_sdk/catalog/data_source/action_model/sql_column.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
class SqlColumn(Base):
1212
data_type: str
1313
name: str
14+
null_value: str | None = None
1415

1516
@staticmethod
1617
def client_class() -> type[ApiSqlColumn]:

packages/gooddata-sdk/tests/catalog/fixtures/data_sources/scan_scan_sql_without_preview.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ interactions:
2222
columns:
2323
- dataType: INT
2424
name: campaign_id
25+
nullValue: '0'
2526
headers:
2627
Content-Type:
2728
- application/json

packages/gooddata-sdk/tests/catalog/fixtures/data_sources/scan_sql.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,13 @@ interactions:
2222
columns:
2323
- dataType: INT
2424
name: product_id
25+
nullValue: '0'
2526
- dataType: STRING
2627
name: product_name
28+
nullValue: _
2729
- dataType: STRING
2830
name: category
31+
nullValue: _
2932
dataPreview:
3033
- - '150'
3134
- Skirt

packages/gooddata-sdk/tests/catalog/fixtures/data_sources/scan_sql_with_nulls_in_preview.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ interactions:
2323
columns:
2424
- dataType: INT
2525
name: campaign_id
26+
nullValue: '0'
2627
dataPreview:
2728
- - null
2829
- - null

0 commit comments

Comments
 (0)