obs_dumpversion and associated tests
This commit is contained in:
parent
7733529ff5
commit
446bdec30d
@ -33,7 +33,8 @@ def select_star(tablename):
|
|||||||
|
|
||||||
cdb = Dumpr('observatory.cartodb.com','')
|
cdb = Dumpr('observatory.cartodb.com','')
|
||||||
|
|
||||||
metadata = ['obs_table', 'obs_column_table', 'obs_column', 'obs_column_tag', 'obs_tag', 'obs_column_to_column']
|
metadata = ['obs_table', 'obs_column_table', 'obs_column', 'obs_column_tag',
|
||||||
|
'obs_tag', 'obs_column_to_column', 'obs_dump_version']
|
||||||
|
|
||||||
fixtures = [
|
fixtures = [
|
||||||
('us.census.tiger.census_tract', 'us.census.tiger.census_tract', '2014'),
|
('us.census.tiger.census_tract', 'us.census.tiger.census_tract', '2014'),
|
||||||
|
@ -199,3 +199,19 @@ BEGIN
|
|||||||
RETURN result;
|
RETURN result;
|
||||||
END;
|
END;
|
||||||
$$ LANGUAGE plpgsql;
|
$$ LANGUAGE plpgsql;
|
||||||
|
|
||||||
|
-- Function that returns the currently deployed obs_dump_version from the
|
||||||
|
-- remote table of the same name.
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION cdb_observatory.OBS_DumpVersion(
|
||||||
|
)
|
||||||
|
RETURNS TEXT
|
||||||
|
AS $$
|
||||||
|
DECLARE
|
||||||
|
result text;
|
||||||
|
BEGIN
|
||||||
|
EXECUTE '
|
||||||
|
SELECT MAX(dump_id) FROM observatory.obs_dump_version
|
||||||
|
' INTO result;
|
||||||
|
END;
|
||||||
|
$$ LANGUAGE plpgsql;
|
||||||
|
@ -27,3 +27,6 @@ t
|
|||||||
_obs_standardizemeasurename_test
|
_obs_standardizemeasurename_test
|
||||||
t
|
t
|
||||||
(1 row)
|
(1 row)
|
||||||
|
obs_getdumpversion_notnull
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
1
src/pg/test/fixtures/drop_fixtures.sql
vendored
1
src/pg/test/fixtures/drop_fixtures.sql
vendored
@ -6,6 +6,7 @@ DROP TABLE IF EXISTS observatory.obs_column;
|
|||||||
DROP TABLE IF EXISTS observatory.obs_column_tag;
|
DROP TABLE IF EXISTS observatory.obs_column_tag;
|
||||||
DROP TABLE IF EXISTS observatory.obs_tag;
|
DROP TABLE IF EXISTS observatory.obs_tag;
|
||||||
DROP TABLE IF EXISTS observatory.obs_column_to_column;
|
DROP TABLE IF EXISTS observatory.obs_column_to_column;
|
||||||
|
DROP TABLE IF EXISTS observatory.obs_dump_version;
|
||||||
DROP TABLE IF EXISTS observatory.obs_65f29658e096ca1485bf683f65fdbc9f05ec3c5d;
|
DROP TABLE IF EXISTS observatory.obs_65f29658e096ca1485bf683f65fdbc9f05ec3c5d;
|
||||||
DROP TABLE IF EXISTS observatory.obs_1746e37b7cd28cb131971ea4187d42d71f09c5f3;
|
DROP TABLE IF EXISTS observatory.obs_1746e37b7cd28cb131971ea4187d42d71f09c5f3;
|
||||||
DROP TABLE IF EXISTS observatory.obs_1a098da56badf5f32e336002b0a81708c40d29cd;
|
DROP TABLE IF EXISTS observatory.obs_1a098da56badf5f32e336002b0a81708c40d29cd;
|
||||||
|
18902
src/pg/test/fixtures/load_fixtures.sql
vendored
18902
src/pg/test/fixtures/load_fixtures.sql
vendored
File diff suppressed because one or more lines are too long
@ -75,4 +75,7 @@ SELECT cdb_observatory._OBS_GetRelatedColumn(
|
|||||||
-- should give back a standardized measure name
|
-- should give back a standardized measure name
|
||||||
SELECT cdb_observatory._OBS_StandardizeMeasureName('test 343 %% 2 qqq }}{{}}') = 'test_343_2_qqq' As _OBS_StandardizeMeasureName_test;
|
SELECT cdb_observatory._OBS_StandardizeMeasureName('test 343 %% 2 qqq }}{{}}') = 'test_343_2_qqq' As _OBS_StandardizeMeasureName_test;
|
||||||
|
|
||||||
|
SELECT cdb_observatory.OBS_GetDumpVersion()
|
||||||
|
IS NOT NULL AS OBS_GetDumpVersion_notnull;
|
||||||
|
|
||||||
\i test/fixtures/drop_fixtures.sql
|
\i test/fixtures/drop_fixtures.sql
|
||||||
|
Loading…
Reference in New Issue
Block a user