diff --git a/models/root/document_metadata.sql b/models/root/document_metadata.sql index 231e11c1..d3718e3a 100644 --- a/models/root/document_metadata.sql +++ b/models/root/document_metadata.sql @@ -18,7 +18,7 @@ SELECT _deleted, saved_timestamp, doc->>'type' as doc_type -FROM {{ env_var('POSTGRES_SCHEMA') }}.{{ env_var('POSTGRES_TABLE') }} source_table +from {{ source('couchdb', env_var('POSTGRES_TABLE')) }} source_table {% if is_incremental() %} WHERE source_table.saved_timestamp >= {{ max_existing_timestamp('saved_timestamp') }} {% endif %} diff --git a/models/root/tests/document_metadata.yml b/models/root/tests/document_metadata.yml index bc0d5924..58b4b267 100644 --- a/models/root/tests/document_metadata.yml +++ b/models/root/tests/document_metadata.yml @@ -8,7 +8,7 @@ unit_tests: macros: is_incremental: false given: - - input: ref('test_source_table') + - input: source('couchdb', "{{ env_var('POSTGRES_TABLE') }}") format: csv fixture: contacts_test_source_table_input expect: diff --git a/models/root/tests/test_source_table.sql b/models/root/tests/test_source_table.sql deleted file mode 100644 index 1d3f0140..00000000 --- a/models/root/tests/test_source_table.sql +++ /dev/null @@ -1,7 +0,0 @@ -{{ config(materialized='table') }} - -select - null::timestamp as saved_timestamp, - null::text as _id, - null::boolean as _deleted, - null::jsonb as doc