Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ingest/mssql): Add MONEY and SMALLMONEY data types as Number #9313

Merged
merged 4 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,16 @@
)
from datahub.metadata.schema_classes import (
BooleanTypeClass,
NumberTypeClass,
StringTypeClass,
UnionTypeClass,
)

logger: logging.Logger = logging.getLogger(__name__)

register_custom_type(sqlalchemy.dialects.mssql.BIT, BooleanTypeClass)
register_custom_type(sqlalchemy.dialects.mssql.MONEY, NumberTypeClass)
register_custom_type(sqlalchemy.dialects.mssql.SMALLMONEY, NumberTypeClass)
register_custom_type(sqlalchemy.dialects.mssql.SQL_VARIANT, UnionTypeClass)
register_custom_type(sqlalchemy.dialects.mssql.UNIQUEIDENTIFIER, StringTypeClass)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@
"aspect": {
"json": {
"customProperties": {
"job_id": "1f2f14ba-db84-4fa1-910e-7df71bede642",
"job_id": "3565ea3e-9a3a-4cb0-acd5-213d740479a0",
"job_name": "Weekly Demo Data Backup",
"description": "No description available.",
"date_created": "2023-10-27 10:11:55.540000",
"date_modified": "2023-10-27 10:11:55.667000",
"date_created": "2023-11-27 23:08:29.350000",
"date_modified": "2023-11-27 23:08:29.833000",
"step_id": "1",
"step_name": "Set database to read only",
"subsystem": "TSQL",
Expand Down Expand Up @@ -1961,8 +1961,8 @@
"code": "CREATE PROCEDURE [Foo].[Proc.With.SpecialChar] @ID INT\nAS\n SELECT @ID AS ThatDB;\n",
"input parameters": "['@ID']",
"parameter @ID": "{'type': 'int'}",
"date_created": "2023-10-27 10:11:55.460000",
"date_modified": "2023-10-27 10:11:55.460000"
"date_created": "2023-11-27 23:08:29.077000",
"date_modified": "2023-11-27 23:08:29.077000"
},
"externalUrl": "",
"name": "demodata.Foo.Proc.With.SpecialChar",
Expand Down Expand Up @@ -3575,6 +3575,18 @@
"nativeDataType": "NVARCHAR()",
"recursive": false,
"isPartOfKey": false
},
{
"fieldPath": "Price",
"nullable": true,
"type": {
"type": {
"com.linkedin.pegasus2avro.schema.NumberType": {}
}
},
"nativeDataType": "MONEY()",
"recursive": false,
"isPartOfKey": false
}
]
}
Expand Down Expand Up @@ -3816,6 +3828,18 @@
"nativeDataType": "NVARCHAR()",
"recursive": false,
"isPartOfKey": false
},
{
"fieldPath": "Price",
"nullable": true,
"type": {
"type": {
"com.linkedin.pegasus2avro.schema.NumberType": {}
}
},
"nativeDataType": "SMALLMONEY()",
"recursive": false,
"isPartOfKey": false
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ CREATE DATABASE NewData;
GO
USE NewData;
GO
CREATE TABLE ProductsNew (ID int, ProductName nvarchar(max));
CREATE TABLE ProductsNew (ID int, ProductName nvarchar(max), Price money);
GO
CREATE SCHEMA FooNew;
GO
CREATE TABLE FooNew.ItemsNew (ID int, ItemName nvarchar(max));
CREATE TABLE FooNew.ItemsNew (ID int, ItemName nvarchar(max), Price smallmoney);
GO
CREATE TABLE FooNew.PersonsNew (
ID int NOT NULL PRIMARY KEY,
Expand Down