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

feature(fivetran_sdk): Add support for DataType Param #45

Merged
merged 2 commits into from
Jun 13, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ message DecimalParams {
uint32 scale = 2;
}

message DataTypeParams {
oneof params {
DecimalParams decimal = 1;
int32 string_byte_length = 2;
}
}

enum RecordType {
UPSERT = 0;
UPDATE = 1;
Expand Down Expand Up @@ -153,5 +160,5 @@ message Column {
string name = 1;
DataType type = 2;
bool primary_key = 3;
optional DecimalParams decimal = 4;
optional DataTypeParams params = 4;
}
3 changes: 2 additions & 1 deletion destination_sdk.proto
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ message SchemaDiff {
oneof change {
Column add_column = 1;
ChangeType change_column_type = 2;
PrimaryKey new_primary_key = 3;
PrimaryKey updated_primary_keys = 3;
}
}

Expand All @@ -100,6 +100,7 @@ message PrimaryKey {
message ChangeType {
string column_name = 1;
DataType new_type = 2;
optional DataTypeParams params = 3;
}

message AlterTableResponse {
Expand Down
191 changes: 103 additions & 88 deletions tools/destination-tester/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,98 +45,113 @@ Here is an example input file named `input_1.json`:

```json
{
"create_table" : {
"transaction": {
"columns": {
"id": "INT",
"amount" : "DOUBLE",
"desc": "STRING"
},
"primary_key": ["id"]
"create_table" : {
"transaction": {
"columns": {
"id": "INT",
"amount" : "DOUBLE",
"desc": {"type": "STRING", "string_byte_length": 256}
},
"primary_key": ["id"]
},
"campaign": {
"columns": {
"name": "STRING",
"num": {"type": "DECIMAL", "precision": 6, "scale": 3}
},
"primary_key": []
}
},
"alter_table" : {
"transaction":
{
"add_column": {
"columns": {
"order_id": "INT",
"value": {
"type": "DECIMAL",
"precision": 6,
"scale": 3
}
},
"campaign": {
"columns": {
"name": "STRING",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep this one like this to show that byte length is optional

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

"num": {"type": "DECIMAL", "precision": 6, "scale": 3}
},
"primary_key": []
}
"primary_key": [
"order_id"
]
},
"updated_primary_keys": [
"id",
"order_id"
],
"change_column_type": {
"amount": "FLOAT"
}
}
},
"describe_table" : [
"transaction"
],
"ops" : [
{
"upsert": {
"transaction": [
{"id":1, "amount": 100.45, "desc": null, "order_id": 1, "value": 10.10},
{"id":2, "amount": 150.33, "desc": "two", "order_id": 2, "value": 10.20}
],
"campaign": [
{"_fivetran_id": "abc-123-xyz", "name": "Christmas", "num": 100.23},
{"_fivetran_id": "vbn-543-hjk", "name": "New Year", "num": 200.56}
]
}
},
{
"truncate_before": [
"campaign"
]
},
"alter_table" : {
"transaction": {
"columns": {
"id": "INT",
"amount" : "FLOAT",
"desc": "STRING"
},
"primary_key": ["id"]
}
{
"update": {
"transaction": [
{"id":1, "amount": 200}
]
}
},
"describe_table" : [
{
"soft_truncate_before": [
"transaction"
],
"ops" : [
{
"upsert": {
"transaction": [
{"id":1, "amount": 100.45, "desc": null},
{"id":2, "amount": 150.33, "desc": "two"}
],
"campaign": [
{"_fivetran_id": "abc-123-xyz", "name": "Christmas", "num": 100.23},
{"_fivetran_id": "vbn-543-hjk", "name": "New Year", "num": 200.56}
]
}
},
{
"truncate_before": [
"campaign"
]
},
{
"update": {
"transaction": [
{"id":1, "amount": 200}
]
}
},
{
"soft_truncate_before": [
"transaction"
]
},
{
"upsert": {
"transaction": [
{"id":10, "amount": 100, "desc": "thee"},
{"id":20, "amount": 50, "desc": "mone"}
],
"campaign": [
{"_fivetran_id": "dfg-890-lkj", "name": "Christmas 2", "num": 400.32}
]
}
},
{
"delete": {
"transaction": [
{"id":3}
],
"campaign": [
{"_fivetran_id": "abc-123-xyz"}
]
}
},
{
"soft_delete": {
"transaction": [
{"id":4}
],
"campaign": [
{"_fivetran_id": "dfg-890-lkj"}
]
}
}
]
]
},
{
"upsert": {
"transaction": [
{"id":10, "amount": 100, "desc": "thee", "order_id": 3, "value": 10.30},
{"id":20, "amount": 50, "desc": "mone", "order_id": 4, "value": 10.40}
],
"campaign": [
{"_fivetran_id": "dfg-890-lkj", "name": "Christmas 2", "num": 400.32}
]
}
},
{
"delete": {
"transaction": [
{"id":3}
],
"campaign": [
{"_fivetran_id": "abc-123-xyz"}
]
}
},
{
"soft_delete": {
"transaction": [
{"id":4}
],
"campaign": [
{"_fivetran_id": "dfg-890-lkj"}
]
}
}
]
}

```
Expand Down