Skip to content

Conversation

martinjunger
Copy link
Contributor

Jira: KBC-2929

@martinjunger
Copy link
Contributor Author

martinjunger commented Sep 29, 2022

Varianta 1 - FullImportCustomQueryTest - vsechno pres mocky:

'=== queries'
'CREATE TEMPORARY TABLE "stageSchemaName"."stageTableName"\n
 (\n
 "sourceCol1" INT\n
 );'
'---------'
'CREATE TABLE "destSchemaName"."destTableName"\n
 (\n
 "destCol1" INT,\n
 "destColTimestamp" TIMESTAMP\n
 );'
'---------'
'COPY INTO "stageSchemaName"."stageTableName" \n
 FROM 'sourceContainerUrl'\n
 CREDENTIALS=(AZURE_SAS_TOKEN='sourceSasToken')\n
 FILE_FORMAT = (TYPE=CSV FIELD_DELIMITER = ',' SKIP_HEADER = 1 FIELD_OPTIONALLY_ENCLOSED_BY = '\"' ESCAPE_UNENCLOSED_FIELD = NONE)\n
 FILES = ('sourceFile1')'
'---------'
'BEGIN TRANSACTION'
'---------'
'TRUNCATE TABLE "destSchemaName"."destTableName"'
'---------'
'INSERT INTO "destSchemaName"."destTableName" ("sourceCol1") (SELECT "sourceCol1" FROM "stageSchemaName"."stageTableName" AS "src")'
'---------'
'COMMIT'
'---------'

Varianta 2 - FullImportCustomQueryFakeTest - fake driver + ostatni pres mocky:

'=== queries'
'CREATE TEMPORARY TABLE "stageSchemaName"."stageTableName"\n
 (\n
 "sourceCol1" INT\n
 );'
'---------'
'CREATE TABLE "destSchemaName"."destTableName"\n
 (\n
 "destCol1" INT,\n
 "destColTimestamp" TIMESTAMP\n
 );'
'---------'
'COPY INTO "stageSchemaName"."stageTableName" \n
 FROM 'sourceContainerUrl'\n
 CREDENTIALS=(AZURE_SAS_TOKEN='sourceSasToken')\n
 FILE_FORMAT = (TYPE=CSV FIELD_DELIMITER = ',' SKIP_HEADER = 1 FIELD_OPTIONALLY_ENCLOSED_BY = '\"' ESCAPE_UNENCLOSED_FIELD = NONE)\n
 FILES = ('sourceFile1')'
'---------'
'SELECT COUNT(*) AS NumberOfRows FROM "stageSchemaName"."stageTableName"'
'---------'
'BEGIN TRANSACTION'
'---------'
'TRUNCATE TABLE "destSchemaName"."destTableName"'
'---------'
'INSERT INTO "destSchemaName"."destTableName" ("sourceCol1") (SELECT "sourceCol1" FROM "stageSchemaName"."stageTableName" AS "src")'
'---------'
'COMMIT'
'---------'

@martinjunger
Copy link
Contributor Author

V obou pripadech je potreba pritahnout jako zavislost PhpUnit.
Potom by melo stacit nadefinovat tridy napr. FullImportFlow, IncrementalImportFlow a dalsi, a logiku presunout do nich.
Tyhle flow tridy by se potom volaly z komponenty.

@martinjunger
Copy link
Contributor Author

Moved to CustomQuery component: keboola/app-custom-query-manager#1

@martinjunger martinjunger deleted the mj-query-template-2 branch October 31, 2022 16:04
romanbracinik pushed a commit that referenced this pull request Apr 23, 2024
BIG-245 add QueryExecutor to improve query pooling control
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants