This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Transformation code for Snowflake backend, assumes that the input table is named "cur" | |
-- Fills gaps in currency rates by the last known value | |
DROP TABLE IF EXISTS "curdates"; | |
DROP TABLE IF EXISTS "outCur"; | |
CREATE TABLE "curdates" AS ( | |
SELECT "date", | |
TO_CHAR("date", 'YYYY-MM-DD') || (SELECT DISTINCT "fromCurrency" FROM "cur" LIMIT 1) || "currency" AS "id", | |
"currency" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE TABLE "test" ("id" INTEGER, "text" VARCHAR); | |
INSERT INTO "test" ("id", "text") VALUES (1, 'first'), (2, 'second'), (3, NULL), | |
(4, NULL), (5, 'fifth'), (6, NULL), (7, NULL), (8, NULL), (9, 'ninth'); | |
SELECT * FROM "test" ORDER BY "id"; | |
SELECT "id", | |
COALESCE("text", FIRST_VALUE("leadText") OVER (PARTITION BY "grp" ORDER BY "id")) AS "text" | |
FROM | |
( | |
SELECT *, SUM(CASE WHEN "leadText" IS NOT NULL AND "text" IS NULL OR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"parameters": { | |
"api": { | |
"baseUrl": "https://api.oncollabim.com/", | |
"pagination": { | |
"method": "pagenum" | |
} | |
}, | |
"config": { | |
"debug": true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"parameters": { | |
"api": { | |
"authentication": { | |
"type": "basic" | |
}, | |
"baseUrl": "https://yourElastisearchHost.com", | |
"pagination": { | |
"method": "response.param", | |
"responseParam": "_scroll_id", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"parameters": { | |
"api": { | |
"authentication": { | |
"type": "basic" | |
}, | |
"baseUrl": "https://toggl.com/" | |
}, | |
"config": { | |
"id": "toggl", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$pdo = $this->connect(); | |
$stmt = $pdo->prepare('SELECT …'); | |
while (true) { | |
try { | |
$stmt->execute(); | |
while ($row = $stmt->fetch()) { | |
write_row_to_csv($row); | |
} | |
break; //success |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$stmt = $pdo->prepare('SELECT …'); | |
$stmt->execute(); | |
while ($row = $stmt->fetch()) { | |
write_row_to_csv($row); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$pdo = $this->connect(); | |
while (true) { | |
try { | |
$stmt = $pdo->prepare('SELECT …'); // <- must be inside the loop | |
$stmt->execute(); | |
while ($row = $stmt->fetch()) { | |
write_row_to_csv($row); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
testConnectionRetry() | |
{ | |
$rows = 1000000; | |
$credentials = $this->setupTestDatabaseConnetion(); | |
$table = $this->createLargeTable($credentials, $rows); | |
$configFile = $this->createConfigFile($credentials, $table); | |
$extractor = new Extractor($configFile); | |
exec('cports /close * * * 3600'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
testConnectionRetry() | |
{ | |
$rows = 1000000; | |
$credentials = $this->setupTestDatabaseConnetion(); | |
$table = $this->createLargeTable($credentials, $rows); | |
$configFile = $this->createConfigFile($credentials, $table); | |
$extractor = new Extractor($configFile); | |
exec('php killConnection.php 10 > /dev/null &'); |
OlderNewer