Add Airflow Migrations for IAM RDS connection (#12259)

* Add Migrations

* Add not null

* Resolve comments
This commit is contained in:
Ayush Shah 2023-07-03 15:16:30 +05:30 committed by GitHub
parent dbb5013dc1
commit 93c405365b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 1 deletions

View File

@ -344,4 +344,18 @@ SET json = JSON_INSERT(
)
)
)
WHERE name = 'tableCustomSQLQuery';
WHERE name = 'tableCustomSQLQuery';
-- Modify migrations for service connection of airflow to move password under authType if
-- Connection Type as Mysql or Postgres
UPDATE pipeline_service_entity
SET json = JSON_INSERT(
JSON_REMOVE(json, '$.connection.config.connection.password'),
'$.connection.config.connection.authType',
JSON_OBJECT(),
'$.connection.config.connection.authType.password',
JSON_EXTRACT(json, '$.connection.config.connection.password'))
where serviceType = 'Airflow'
AND JSON_EXTRACT(json, '$.connection.config.connection.type') in ('Postgres', 'Mysql')
AND JSON_EXTRACT(json, '$.connection.config.connection.password') IS NOT NULL;

View File

@ -177,3 +177,18 @@ set json = jsonb_set(
'[{"name":"sqlExpression","displayName":"SQL Expression","description":"SQL expression to run against the table","dataType":"STRING","required":"true"},{"name":"strategy","displayName":"Strategy","description":"Strategy to use to run the custom SQL query (i.e. `SELECT COUNT(<col>)` or `SELECT <col> (defaults to ROWS)","dataType":"ARRAY","optionValues":["ROWS","COUNT"],"required":false},{"name":"threshold","displayName":"Threshold","description":"Threshold to use to determine if the test passes or fails (defaults to 0).","dataType":"NUMBER","required":false}]'
)
where name = 'tableCustomSQLQuery';
-- Modify migrations for service connection of airflow to move password under authType if
-- Connection Type as Mysql or Postgres
UPDATE pipeline_service_entity
SET json = jsonb_set(
json #-'{connection,config,connection,password}',
'{connection,config,connection,authType}',
jsonb_build_object('password',json#>'{connection,config,connection,password}')
)
WHERE serviceType = 'Airflow'
and json#>'{connection,config,connection,type}' IN ('"Mysql"', '"Postgres"')
and json#>'{connection,config,connection,password}' is not null;