Closed martinjunger closed 2 years ago
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'
'---------'
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.
Moved to CustomQuery component: https://github.com/keboola/app-custom-query-manager/pull/1
Jira: KBC-2929