-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Why? Inferring the type in case a string is passed in the payload instead of the corresponding data type improves the user experience Type conversion can be relegated to vdk instead of doing pre-processing of large payloads inside data jobs What? Add column data types to column cache In case a string is passed, infer the python data type based on the Oracle column data type In case math.nan is passed, write NULL to the Oracle table How was this tested? Ran functional tests locally CI/CD What kind of change is this? Feature/non-breaking Signed-off-by: Dilyan Marinov <[email protected]>
- Loading branch information
1 parent
0758787
commit 3b9e8cb
Showing
6 changed files
with
97 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...ects/vdk-plugins/vdk-oracle/tests/jobs/oracle-ingest-job-type-inference/00_drop_table.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
begin | ||
execute immediate 'drop table test_table'; | ||
exception when others then if sqlcode <> -942 then raise; end if; | ||
end; |
10 changes: 10 additions & 0 deletions
10
...ts/vdk-plugins/vdk-oracle/tests/jobs/oracle-ingest-job-type-inference/10_create_table.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
create table test_table ( | ||
id number, | ||
str_data varchar2(255), | ||
int_data number, | ||
nan_int_data number, | ||
float_data float, | ||
bool_data number(1), | ||
timestamp_data timestamp, | ||
decimal_data decimal(14,8), | ||
primary key(id)) |
20 changes: 20 additions & 0 deletions
20
projects/vdk-plugins/vdk-oracle/tests/jobs/oracle-ingest-job-type-inference/20_ingest.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright 2021-2023 VMware, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
import datetime | ||
import math | ||
from decimal import Decimal | ||
|
||
|
||
def run(job_input): | ||
payload = { | ||
"id": "5", | ||
"str_data": "string", | ||
"int_data": "12", | ||
"nan_int_data": math.nan, | ||
"float_data": "1.2", | ||
"bool_data": "False", | ||
"timestamp_data": "2023-11-21T08:12:53", | ||
"decimal_data": "0.1", | ||
} | ||
|
||
job_input.send_object_for_ingestion(payload=payload, destination_table="test_table") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters