Skip to content

Commit

Permalink
fix: redshift serverless bq partitioning configuration changes (#1730)
Browse files Browse the repository at this point in the history
  • Loading branch information
achettyiitr authored Oct 3, 2024
1 parent 20f6cc4 commit 57563e1
Show file tree
Hide file tree
Showing 8 changed files with 308 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/configurations/destinations/bq/db-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
"skipUsersTable",
"jsonPaths",
"underscoreDivideNumbers",
"allowUsersContextTraits"
"allowUsersContextTraits",
"partitionColumn",
"partitionType"
],
"android": [
"connectionMode",
Expand Down
10 changes: 10 additions & 0 deletions src/configurations/destinations/bq/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@
"pattern": "^(5|15|30|60|180|360|720|1440)$",
"default": "180"
},
"partitionColumn": {
"type": "string",
"pattern": "^(_PARTITIONTIME|loaded_at|received_at)$",
"default": "_PARTITIONTIME"
},
"partitionType": {
"type": "string",
"pattern": "^(hour|day)$",
"default": "day"
},
"syncStartAt": {
"type": "string"
},
Expand Down
46 changes: 46 additions & 0 deletions src/configurations/destinations/bq/ui-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,52 @@
},
"required": false,
"footerNote": "Note: Please specify time in UTC"
},
{
"type": "singleSelect",
"immutable": true,
"label": "Partition Column",
"value": "partitionColumn",
"options": [
{
"name": "Ingestion Time",
"value": "_PARTITIONTIME"
},
{
"name": "Loaded At",
"value": "loaded_at"
},
{
"name": "Received At",
"value": "received_at"
}
],
"defaultOption": {
"name": "Ingestion Time",
"value": "_PARTITIONTIME"
},
"required": false
},
{
"type": "singleSelect",
"immutable": true,
"label": "Partition Type",
"value": "partitionType",
"options": [
{
"name": "Hour",
"value": "hour"
},
{
"name": "Day",
"value": "day"
}
],
"defaultOption": {
"name": "Day",
"value": "day"
},
"required": false
}
]
},
Expand Down
2 changes: 2 additions & 0 deletions src/configurations/destinations/rs/db-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
"iamRoleARNForAuth",
"clusterId",
"clusterRegion",
"useServerless",
"workgroupName",
"bucketName",
"iamRoleARN",
"roleBasedAuth",
Expand Down
42 changes: 37 additions & 5 deletions src/configurations/destinations/rs/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -941,19 +941,51 @@
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
},
"clusterId": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,255})$"
},
"clusterRegion": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,255})$"
},
"useIAMForAuth": {
"const": true
},
"useServerless": {
"type": "boolean",
"default": false
}
},
"required": ["clusterId", "clusterRegion", "iamRoleARNForAuth", "useIAMForAuth"]
"anyOf": [
{
"properties": {
"clusterId": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,255})$"
},
"useServerless": {
"const": false
},
"useIAMForAuth": {
"const": true
}
},
"required": ["clusterId", "useIAMForAuth"]
},
{
"properties": {
"workgroupName": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,255})$"
},
"useIAMForAuth": {
"const": true
},
"useServerless": {
"const": true
}
},
"required": ["workgroupName", "useIAMForAuth", "useServerless"]
}
],
"required": ["clusterRegion", "iamRoleARNForAuth", "useIAMForAuth"]
}
},
{
Expand Down
36 changes: 36 additions & 0 deletions src/configurations/destinations/rs/ui-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,29 @@
"placeholder": "5439",
"required": true
},
{
"type": "checkbox",
"preRequisiteField": [
{
"name": "useIAMForAuth",
"selectedValue": true
}
],
"label": "Use Redshift Serverless",
"value": "useServerless",
"required": false,
"default": false
},
{
"type": "textInput",
"preRequisiteField": [
{
"name": "useIAMForAuth",
"selectedValue": true
},
{
"name": "useServerless",
"selectedValue": false
}
],
"label": "Cluster Id",
Expand All @@ -55,6 +72,25 @@
"placeholder": "Cluster Identifier",
"required": true
},
{
"type": "textInput",
"preRequisiteField": [
{
"name": "useIAMForAuth",
"selectedValue": true
},
{
"name": "useServerless",
"selectedValue": true
}
],
"label": "Workgroup Name",
"value": "workgroupName",
"regex": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,255})$",
"regexErrorMessage": "Invalid Workgroup Name",
"placeholder": "Workgroup Name",
"required": true
},
{
"type": "textInput",
"preRequisiteField": [
Expand Down
68 changes: 68 additions & 0 deletions test/data/validation/destinations/bq.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,74 @@
},
"result": true
},
{
"config": {
"project": "test-gcs-project",
"location": "",
"bucketName": "test-bucket",
"prefix": "xyzxx",
"namespace": "eu_new3",
"partitionColumn": "_PARTITIONTIME",
"partitionType": "day",
"credentials": "{}",
"syncFrequency": "30",
"testConnection": false,
"testConnectionTS": 1621402528550
},
"result": true
},
{
"config": {
"project": "test-gcs-project",
"location": "",
"bucketName": "test-bucket",
"prefix": "xyzxx",
"namespace": "eu_new3",
"partitionColumn": "received_at",
"partitionType": "hour",
"credentials": "{}",
"syncFrequency": "30",
"testConnection": false,
"testConnectionTS": 1621402528550
},
"result": true
},
{
"config": {
"project": "test-gcs-project",
"location": "",
"bucketName": "test-bucket",
"prefix": "xyzxx",
"namespace": "eu_new3",
"partitionColumn": "invalid",
"partitionType": "day",
"credentials": "{}",
"syncFrequency": "30",
"testConnection": false,
"testConnectionTS": 1621402528550
},
"result": false,
"error": [
"partitionColumn must match pattern \"^(_PARTITIONTIME|loaded_at|received_at|timestamp)$\""
]
},
{
"config": {
"project": "test-gcs-project",
"location": "",
"bucketName": "test-bucket",
"prefix": "xyzxx",
"namespace": "eu_new3",
"partitionColumn": "_PARTITIONTIME",
"partitionType": "invalid",
"credentials": "{}",
"syncFrequency": "30",
"testConnection": false,
"testConnectionTS": 1621402528550
},
"result": false,
"error": ["partitionType must match pattern \"^(hour|day|month|year)$\""]
},
{
"config": {
"project": "test-gcs-project",
Expand Down
106 changes: 106 additions & 0 deletions test/data/validation/destinations/rs.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,117 @@
"result": false,
"err": [
" must have required property 'clusterId'",
" must have required property 'workgroupName'",
" must have required property 'useServerless'",
" must match a schema in anyOf",
" must have required property 'clusterRegion'",
" must have required property 'iamRoleARNForAuth'",
" must match \"then\" schema"
]
},
{
"config": {
"host": "",
"password": "",
"port": "",
"database": "test-database",
"user": "test-user",
"useIAMForAuth": true,
"useServerless": false,
"iamRoleARNForAuth": "iamRoleARNForAuth",
"clusterId": "clusterId",
"clusterRegion": "clusterRegion",
"useSSH": false,
"syncFrequency": "30",
"enableSSE": false,
"useRudderStorage": false,
"useSTSTokens": false,
"bucketName": "test-bucket",
"roleBasedAuth": false,
"accessKeyID": "",
"accessKey": ""
},
"result": true
},
{
"config": {
"host": "",
"password": "",
"port": "",
"database": "test-database",
"user": "test-user",
"useIAMForAuth": true,
"useServerless": true,
"iamRoleARNForAuth": "iamRoleARNForAuth",
"clusterId": "clusterId",
"clusterRegion": "clusterRegion",
"useSSH": false,
"syncFrequency": "30",
"enableSSE": false,
"useRudderStorage": false,
"useSTSTokens": false,
"bucketName": "test-bucket",
"roleBasedAuth": false,
"accessKeyID": "",
"accessKey": ""
},
"result": false,
"err": [
"useServerless must be equal to constant",
" must have required property 'workgroupName'",
" must match a schema in anyOf",
" must match \"then\" schema"
]
},
{
"config": {
"host": "",
"password": "",
"port": "",
"database": "test-database",
"user": "test-user",
"useIAMForAuth": true,
"useServerless": true,
"iamRoleARNForAuth": "iamRoleARNForAuth",
"workgroupName": "workgroupName",
"clusterRegion": "clusterRegion",
"useSSH": false,
"syncFrequency": "30",
"enableSSE": false,
"useRudderStorage": false,
"useSTSTokens": false,
"bucketName": "test-bucket",
"roleBasedAuth": false,
"accessKeyID": "",
"accessKey": ""
},
"result": true
},
{
"config": {
"host": "",
"password": "",
"port": "",
"database": "test-database",
"user": "test-user",
"useIAMForAuth": true,
"useServerless": true,
"iamRoleARNForAuth": "iamRoleARNForAuth",
"clusterId": "clusterId",
"workgroupName": "workgroupName",
"clusterRegion": "clusterRegion",
"useSSH": false,
"syncFrequency": "30",
"enableSSE": false,
"useRudderStorage": false,
"useSTSTokens": false,
"bucketName": "test-bucket",
"roleBasedAuth": false,
"accessKeyID": "",
"accessKey": ""
},
"result": true
},
{
"config": {
"host": "test-host",
Expand Down

0 comments on commit 57563e1

Please sign in to comment.