Merge pull request #237 from CartoDB/analysis-catalog
Adds table for storing camshaft analysis nodes
This commit is contained in:
commit
808fc9fc25
24
scripts-available/CDB_AnalysisCatalog.sql
Normal file
24
scripts-available/CDB_AnalysisCatalog.sql
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
-- Table to register analysis nodes from https://github.com/cartodb/camshaft
|
||||||
|
CREATE TABLE IF NOT EXISTS
|
||||||
|
cartodb.cdb_analysis_catalog (
|
||||||
|
-- md5 hex hash
|
||||||
|
node_id char(40) CONSTRAINT cdb_analysis_catalog_pkey PRIMARY KEY,
|
||||||
|
-- being json allows to do queries like analysis_def->>'type' = 'buffer'
|
||||||
|
analysis_def json NOT NULL,
|
||||||
|
-- can reference other nodes in this very same table, allowing recursive queries
|
||||||
|
input_nodes char(40) ARRAY NOT NULL DEFAULT '{}',
|
||||||
|
status TEXT NOT NULL DEFAULT 'pending',
|
||||||
|
CONSTRAINT valid_status CHECK (
|
||||||
|
status IN ( 'pending', 'waiting', 'running', 'canceled', 'failed', 'ready' )
|
||||||
|
),
|
||||||
|
created_at timestamp with time zone NOT NULL DEFAULT now(),
|
||||||
|
-- should be updated when some operation was performed in the node
|
||||||
|
-- and anything associated to it might have changed
|
||||||
|
updated_at timestamp with time zone DEFAULT NULL,
|
||||||
|
-- should register last time the node was used
|
||||||
|
used_at timestamp with time zone NOT NULL DEFAULT now(),
|
||||||
|
-- should register the number of times the node was used
|
||||||
|
hits NUMERIC DEFAULT 0,
|
||||||
|
-- should register what was the last node using current node
|
||||||
|
last_used_from char(40)
|
||||||
|
);
|
1
scripts-enabled/260-CDB_AnalysisCatalog.sql
Symbolic link
1
scripts-enabled/260-CDB_AnalysisCatalog.sql
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../scripts-available/CDB_AnalysisCatalog.sql
|
@ -3,4 +3,5 @@ SET SCHEMA 'cartodb';
|
|||||||
\i scripts-available/CDB_TableMetadata.sql
|
\i scripts-available/CDB_TableMetadata.sql
|
||||||
\i scripts-available/CDB_ColumnNames.sql
|
\i scripts-available/CDB_ColumnNames.sql
|
||||||
\i scripts-available/CDB_ColumnType.sql
|
\i scripts-available/CDB_ColumnType.sql
|
||||||
|
\i scripts-available/CDB_AnalysisCatalog.sql
|
||||||
SET SCHEMA 'public';
|
SET SCHEMA 'public';
|
@ -563,6 +563,13 @@ test_extension|public|"local-table-with-dashes"'
|
|||||||
DATABASE=fdw_target tear_down_database
|
DATABASE=fdw_target tear_down_database
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_cdb_catalog_basic_node() {
|
||||||
|
DEF="'{\"type\":\"buffer\",\"source\":\"b2db66bc7ac02e135fd20bbfef0fdd81b2d15fad\",\"radio\":10000}'"
|
||||||
|
sql postgres "INSERT INTO cartodb.cdb_analysis_catalog (node_id, analysis_def) VALUES ('1bbc4c41ea7c9d3a7dc1509727f698b7', ${DEF}::json)"
|
||||||
|
sql postgres "SELECT status from cartodb.cdb_analysis_catalog where node_id = '1bbc4c41ea7c9d3a7dc1509727f698b7'" should 'pending'
|
||||||
|
sql postgres "DELETE FROM cartodb.cdb_analysis_catalog"
|
||||||
|
}
|
||||||
|
|
||||||
#################################################### TESTS END HERE ####################################################
|
#################################################### TESTS END HERE ####################################################
|
||||||
|
|
||||||
run_tests $@
|
run_tests $@
|
||||||
|
Loading…
Reference in New Issue
Block a user