Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kovid-r
Last active November 25, 2021 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kovid-r/1819733628ef2eba7355fbbf40331665 to your computer and use it in GitHub Desktop.
Save kovid-r/1819733628ef2eba7355fbbf40331665 to your computer and use it in GitHub Desktop.
Amundsen Lineage + dbt manifest.json /databuilder/example/sample_data/dbt/manifest.json
{
"metadata": {
"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v1.json",
"dbt_version": "0.19.1",
"generated_at": "2021-04-20T19:44:40.433304Z",
"invocation_id": "2c6e4c85-3912-40cc-b613-0a50c65e32bc",
"env": {},
"project_id": "f005e70093f1ddd3daa6316f5ec6f69e",
"user_id": "8ea306a1-9d65-47b6-af2e-a29869f560dc",
"send_anonymous_usage_stats": true,
"adapter_type": "snowflake"
},
"nodes": {
"model.dbt_amundsen_demo.fact_third_party_performance": {
"raw_sql": "select\n third_party.cc_company as company_id,\n third_party.cc_company_name as company_name,\n sum(item_call_center_loss) as total_loss,\n sum(item_call_center_loss) / sum(item_call_center_cnt) as avg_item_loss\nfrom {{ ref('fact_catalog_returns') }} fact_catalog_returns\njoin \"SNOWFLAKE_SAMPLE_DATA\".\"TPCDS_SF100TCL\".\"CALL_CENTER\" as third_party\n on third_party.cc_call_center_sk = fact_catalog_returns.cr_call_center_sk\ngroup by 1,2\norder by 4 desc, 3 desc",
"compiled": true,
"resource_type": "model",
"depends_on": {
"macros": [],
"nodes": ["model.dbt_amundsen_demo.fact_catalog_returns"]
},
"config": {
"enabled": true,
"materialized": "view",
"persist_docs": {},
"vars": {},
"quoting": {},
"column_types": {},
"alias": null,
"schema": null,
"database": null,
"tags": [],
"full_refresh": null,
"post-hook": [],
"pre-hook": []
},
"database": "DBT_AMUNDSEN_DEMO",
"schema": "PUBLIC",
"fqn": ["dbt_amundsen_demo", "call_center", "fact_third_party_performance"],
"unique_id": "model.dbt_amundsen_demo.fact_third_party_performance",
"package_name": "dbt_amundsen_demo",
"root_path": "/Users/grantseward/GitHub/dbt_amundsen_demo",
"path": "call_center/fact_third_party_performance.sql",
"original_file_path": "models/call_center/fact_third_party_performance.sql",
"name": "fact_third_party_performance",
"alias": "fact_third_party_performance",
"checksum": {
"name": "sha256",
"checksum": "da5955ffcea53530dd0258ec7f786c2dee618c785966f3f1cae942ae257e4390"
},
"tags": [],
"refs": [
["fact_catalog_returns"]
],
"sources": [],
"description": "The performance for third party vendors loss rate by day.",
"columns": {
"company_id": {
"name": "company_id",
"description": "The ID for the company",
"meta": {},
"data_type": null,
"quote": null,
"tags": ["column_tag", "goes_here"]
},
"company_name": {
"name": "company_name",
"description": "",
"meta": {},
"data_type": null,
"quote": null,
"tags": []
},
"total_loss": {
"name": "total_loss",
"description": "The total loss for the given third party vendor",
"meta": {},
"data_type": null,
"quote": null,
"tags": []
},
"avg_item_loss": {
"name": "avg_item_loss",
"description": "The average loss per item for the given third party vendor",
"meta": {},
"data_type": null,
"quote": null,
"tags": []
}
},
"meta": {},
"docs": {
"show": true
},
"patch_path": "models/call_center/schema.yml",
"build_path": "target/compiled/dbt_amundsen_demo/models/call_center/fact_third_party_performance.sql",
"deferred": false,
"unrendered_config": {},
"compiled_sql": "select\n third_party.cc_company as company_id,\n third_party.cc_company_name as company_name,\n sum(item_call_center_loss) as total_loss,\n sum(item_call_center_loss) / sum(item_call_center_cnt) as avg_item_loss\nfrom DBT_AMUNDSEN_DEMO.DBT_AMUNDSEN.fact_catalog_returns fact_catalog_returns\njoin \"SNOWFLAKE_SAMPLE_DATA\".\"TPCDS_SF100TCL\".\"CALL_CENTER\" as third_party\n on third_party.cc_call_center_sk = fact_catalog_returns.cr_call_center_sk\ngroup by 1,2\norder by 4 desc, 3 desc",
"extra_ctes_injected": true,
"extra_ctes": [],
"relation_name": "DBT_AMUNDSEN_DEMO.DBT_AMUNDSEN.fact_third_party_performance"
},
"model.dbt_amundsen_demo.fact_catalog_returns": {
"raw_sql": "select\n catalog_returns.cr_item_sk,\n catalog_returns.cr_call_center_sk,\n sum(catalog_returns.cr_net_loss) as item_call_center_loss,\n count(*) as item_call_center_cnt\nfrom (\n select\n catalog_returns.cr_item_sk,\n catalog_returns.cr_call_center_sk,\n catalog_returns.cr_net_loss\n from \"SNOWFLAKE_SAMPLE_DATA\".\"TPCDS_SF100TCL\".\"CATALOG_RETURNS\" as catalog_returns\n) catalog_returns\ngroup by 1,2\norder by 3 desc",
"compiled": true,
"resource_type": "model",
"depends_on": {
"macros": [],
"nodes": []
},
"config": {
"enabled": true,
"materialized": "view",
"persist_docs": {},
"vars": {},
"quoting": {},
"column_types": {},
"alias": null,
"schema": null,
"database": null,
"tags": [],
"full_refresh": null,
"post-hook": [],
"pre-hook": []
},
"database": "DBT_AMUNDSEN_DEMO",
"schema": "PUBLIC",
"fqn": ["dbt_amundsen_demo", "call_center", "fact_catalog_returns"],
"unique_id": "model.dbt_amundsen_demo.fact_catalog_returns",
"package_name": "dbt_amundsen_demo",
"root_path": "/Users/grantseward/GitHub/dbt_amundsen_demo",
"path": "call_center/fact_catalog_returns.sql",
"original_file_path": "models/call_center/fact_catalog_returns.sql",
"name": "fact_catalog_returns",
"alias": "fact_catalog_returns",
"checksum": {
"name": "sha256",
"checksum": "e302d505ddbb07649638ddf5794e2e94d0831cf2f7cfcecc74e75b4326e4fd3c"
},
"tags": [],
"refs": [],
"sources": [],
"description": "Aggregate item to call center returns within the retail catalog.",
"columns": {
"cr_item_sk": {
"name": "cr_item_sk",
"description": "The item sku",
"meta": {},
"data_type": null,
"quote": null,
"tags": []
},
"cr_call_center_sk": {
"name": "cr_call_center_sk",
"description": "The call center ID",
"meta": {},
"data_type": null,
"quote": null,
"tags": []
},
"item_call_center_loss": {
"name": "item_call_center_loss",
"description": "The total loss for a given item / call center relationship",
"meta": {},
"data_type": null,
"quote": null,
"tags": []
},
"item_call_center_cnt": {
"name": "item_call_center_cnt",
"description": "The number of times a given item was returned for a call center",
"meta": {},
"data_type": null,
"quote": null,
"tags": []
}
},
"meta": {},
"docs": {
"show": true
},
"patch_path": "models/call_center/schema.yml",
"build_path": "target/compiled/dbt_amundsen_demo/models/call_center/fact_catalog_returns.sql",
"deferred": false,
"unrendered_config": {},
"compiled_sql": "select\n catalog_returns.cr_item_sk,\n catalog_returns.cr_call_center_sk,\n sum(catalog_returns.cr_net_loss) as item_call_center_loss,\n count(*) as item_call_center_cnt\nfrom (\n select\n catalog_returns.cr_item_sk,\n catalog_returns.cr_call_center_sk,\n catalog_returns.cr_net_loss\n from \"SNOWFLAKE_SAMPLE_DATA\".\"TPCDS_SF100TCL\".\"CATALOG_RETURNS\" as catalog_returns\n) catalog_returns\ngroup by 1,2\norder by 3 desc",
"extra_ctes_injected": true,
"extra_ctes": [],
"relation_name": "DBT_AMUNDSEN_DEMO.DBT_AMUNDSEN.fact_catalog_returns"
},
"model.dbt_amundsen_demo.raw_inventory_value": {
"raw_sql": "select\n inv_date_sk as dt,\n inv_quantity_on_hand as quantity,\n item.i_current_price as item_price,\n item.i_wholesale_cost as item_cost,\n item.i_current_price * inv_quantity_on_hand as inventory_value,\n item.i_wholesale_cost * inv_quantity_on_hand as inventory_cost\nfrom \"DBT_AMUNDSEN_DEMO\".\"PUBLIC\".\"INVENTORY\" as inv\njoin \"DBT_AMUNDSEN_DEMO\".\"PUBLIC\".\"ITEM\" as item on item.i_item_sk = inv.inv_item_sk",
"compiled": true,
"resource_type": "model",
"depends_on": {
"macros": [],
"nodes": []
},
"config": {
"enabled": true,
"materialized": "view",
"persist_docs": {},
"vars": {},
"quoting": {},
"column_types": {},
"alias": null,
"schema": null,
"database": null,
"tags": [],
"full_refresh": null,
"post-hook": [],
"pre-hook": []
},
"database": "DBT_AMUNDSEN_DEMO",
"schema": "PUBLIC",
"fqn": ["dbt_amundsen_demo", "inventory", "raw_inventory_value"],
"unique_id": "model.dbt_amundsen_demo.raw_inventory_value",
"package_name": "dbt_amundsen_demo",
"root_path": "/Users/grantseward/GitHub/dbt_amundsen_demo",
"path": "inventory/raw_inventory_value.sql",
"original_file_path": "models/inventory/raw_inventory_value.sql",
"name": "raw_inventory_value",
"alias": "raw_inventory_value",
"checksum": {
"name": "sha256",
"checksum": "99344144b461e8fa8c1177c0651d8ec8941f7a6d573b0c2e288d715251e79804"
},
"tags": [],
"refs": [],
"sources": [],
"description": "",
"columns": {},
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"build_path": "target/compiled/dbt_amundsen_demo/models/inventory/raw_inventory_value.sql",
"deferred": false,
"unrendered_config": {},
"compiled_sql": "select\n inv_date_sk as dt,\n inv_quantity_on_hand as quantity,\n item.i_current_price as item_price,\n item.i_wholesale_cost as item_cost,\n item.i_current_price * inv_quantity_on_hand as inventory_value,\n item.i_wholesale_cost * inv_quantity_on_hand as inventory_cost\nfrom \"DBT_AMUNDSEN_DEMO\".\"PUBLIC\".\"INVENTORY\" as inv\njoin \"DBT_AMUNDSEN_DEMO\".\"PUBLIC\".\"ITEM\" as item on item.i_item_sk = inv.inv_item_sk",
"extra_ctes_injected": true,
"extra_ctes": [],
"relation_name": "DBT_AMUNDSEN_DEMO.DBT_AMUNDSEN.raw_inventory_value"
},
"model.dbt_amundsen_demo.fact_warehouse_inventory": {
"raw_sql": "select\n inv_wh.dt as dt,\n inv_wh.w_warehouse_id as w_warehouse_id,\n sum(inv_val.inventory_value) as inventory_value,\n sum(inv_val.inventory_cost) as inventory_cost\nfrom {{ ref('raw_inventory_item_warehouse') }} inv_wh\njoin {{ ref('raw_inventory_value') }} inv_val on inv_val.dt = inv_wh.dt\ngroup by 1,2\norder by 1,2",
"compiled": true,
"resource_type": "model",
"depends_on": {
"macros": [],
"nodes": ["model.dbt_amundsen_demo.raw_inventory_item_warehouse", "model.dbt_amundsen_demo.raw_inventory_value"]
},
"config": {
"enabled": true,
"materialized": "view",
"persist_docs": {},
"vars": {},
"quoting": {},
"column_types": {},
"alias": null,
"schema": null,
"database": null,
"tags": [],
"full_refresh": null,
"post-hook": [],
"pre-hook": []
},
"database": "DBT_AMUNDSEN_DEMO",
"schema": "PUBLIC",
"fqn": ["dbt_amundsen_demo", "inventory", "fact_warehouse_inventory"],
"unique_id": "model.dbt_amundsen_demo.fact_warehouse_inventory",
"package_name": "dbt_amundsen_demo",
"root_path": "/Users/grantseward/GitHub/dbt_amundsen_demo",
"path": "inventory/fact_warehouse_inventory.sql",
"original_file_path": "models/inventory/fact_warehouse_inventory.sql",
"name": "fact_warehouse_inventory",
"alias": "fact_warehouse_inventory",
"checksum": {
"name": "sha256",
"checksum": "f6fef32ceda3ed0719d51fd0a07ab1e53532a403703dd41d39aca32354b92153"
},
"tags": [],
"refs": [
["raw_inventory_item_warehouse"],
["raw_inventory_value"]
],
"sources": [],
"description": "",
"columns": {},
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"build_path": "target/compiled/dbt_amundsen_demo/models/inventory/fact_warehouse_inventory.sql",
"deferred": false,
"unrendered_config": {},
"compiled_sql": "select\n inv_wh.dt as dt,\n inv_wh.w_warehouse_id as w_warehouse_id,\n sum(inv_val.inventory_value) as inventory_value,\n sum(inv_val.inventory_cost) as inventory_cost\nfrom DBT_AMUNDSEN_DEMO.DBT_AMUNDSEN.raw_inventory_item_warehouse inv_wh\njoin DBT_AMUNDSEN_DEMO.DBT_AMUNDSEN.raw_inventory_value inv_val on inv_val.dt = inv_wh.dt\ngroup by 1,2\norder by 1,2",
"extra_ctes_injected": true,
"extra_ctes": [],
"relation_name": "DBT_AMUNDSEN_DEMO.DBT_AMUNDSEN.fact_warehouse_inventory"
},
"model.dbt_amundsen_demo.raw_inventory_item_warehouse": {
"raw_sql": "select\n inv_date_sk as dt,\n wh.w_warehouse_id as w_warehouse_id,\n inv.inv_item_sk as item_id,\n inv.inv_quantity_on_hand as quantity,\n item.i_current_price as item_price,\n item.i_wholesale_cost as item_cost,\n item.i_current_price * inv_quantity_on_hand as inventory_value,\n item.i_wholesale_cost * inv_quantity_on_hand as inventory_cost\nfrom \"DBT_AMUNDSEN_DEMO\".\"PUBLIC\".\"INVENTORY\" as inv\njoin \"DBT_AMUNDSEN_DEMO\".\"PUBLIC\".\"ITEM\" as item on item.i_item_sk = inv.inv_item_sk\njoin \"DBT_AMUNDSEN_DEMO\".\"PUBLIC\".\"WAREHOUSE\" as wh on wh.w_warehouse_sk = inv.inv_warehouse_sk\nlimit 100",
"compiled": true,
"resource_type": "model",
"depends_on": {
"macros": [],
"nodes": []
},
"config": {
"enabled": true,
"materialized": "view",
"persist_docs": {},
"vars": {},
"quoting": {},
"column_types": {},
"alias": null,
"schema": null,
"database": null,
"tags": [],
"full_refresh": null,
"post-hook": [],
"pre-hook": []
},
"database": "DBT_AMUNDSEN_DEMO",
"schema": "PUBLIC",
"fqn": ["dbt_amundsen_demo", "inventory", "raw_inventory_item_warehouse"],
"unique_id": "model.dbt_amundsen_demo.raw_inventory_item_warehouse",
"package_name": "dbt_amundsen_demo",
"root_path": "/Users/grantseward/GitHub/dbt_amundsen_demo",
"path": "inventory/raw_inventory_item_warehouse.sql",
"original_file_path": "models/inventory/raw_inventory_item_warehouse.sql",
"name": "raw_inventory_item_warehouse",
"alias": "raw_inventory_item_warehouse",
"checksum": {
"name": "sha256",
"checksum": "543cf0bb276bbc1b5c6be16c9694a3eb0ee9e83d32f365a80fefe7058c09ee6e"
},
"tags": [],
"refs": [],
"sources": [],
"description": "",
"columns": {},
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"build_path": "target/compiled/dbt_amundsen_demo/models/inventory/raw_inventory_item_warehouse.sql",
"deferred": false,
"unrendered_config": {},
"compiled_sql": "select\n inv_date_sk as dt,\n wh.w_warehouse_id as w_warehouse_id,\n inv.inv_item_sk as item_id,\n inv.inv_quantity_on_hand as quantity,\n item.i_current_price as item_price,\n item.i_wholesale_cost as item_cost,\n item.i_current_price * inv_quantity_on_hand as inventory_value,\n item.i_wholesale_cost * inv_quantity_on_hand as inventory_cost\nfrom \"DBT_AMUNDSEN_DEMO\".\"PUBLIC\".\"INVENTORY\" as inv\njoin \"DBT_AMUNDSEN_DEMO\".\"PUBLIC\".\"ITEM\" as item on item.i_item_sk = inv.inv_item_sk\njoin \"DBT_AMUNDSEN_DEMO\".\"PUBLIC\".\"WAREHOUSE\" as wh on wh.w_warehouse_sk = inv.inv_warehouse_sk\nlimit 100",
"extra_ctes_injected": true,
"extra_ctes": [],
"relation_name": "DBT_AMUNDSEN_DEMO.DBT_AMUNDSEN.raw_inventory_item_warehouse"
},
"model.dbt_amundsen_demo.fact_daily_expenses": {
"raw_sql": "{{ config(alias='cost_summary', schema='PUBLIC', tags=['finance', 'certified'], comment='this is a comment') }}\n\n\nselect\n inv_wh.dt as dt,\n inventory_cost\nfrom {{ ref('fact_warehouse_inventory') }} inv_wh",
"compiled": true,
"resource_type": "model",
"depends_on": {
"macros": [],
"nodes": ["model.dbt_amundsen_demo.fact_warehouse_inventory"]
},
"config": {
"enabled": true,
"materialized": "view",
"persist_docs": {},
"vars": {},
"quoting": {},
"column_types": {},
"alias": "cost_summary",
"schema": "PUBLIC",
"database": null,
"tags": ["finance", "certified"],
"full_refresh": null,
"comment": "this is a comment",
"post-hook": [],
"pre-hook": []
},
"database": "DBT_AMUNDSEN_DEMO",
"schema": "PUBLIC",
"fqn": ["dbt_amundsen_demo", "finance", "fact_daily_expenses"],
"unique_id": "model.dbt_amundsen_demo.fact_daily_expenses",
"package_name": "dbt_amundsen_demo",
"root_path": "/Users/grantseward/GitHub/dbt_amundsen_demo",
"path": "finance/fact_daily_expenses.sql",
"original_file_path": "models/finance/fact_daily_expenses.sql",
"name": "fact_daily_expenses",
"alias": "cost_summary",
"checksum": {
"name": "sha256",
"checksum": "b46ac277061465d252c4912cf8f8c098f2d3d5200b9c330eba9908f2a9d53b44"
},
"tags": ["finance", "certified"],
"refs": [
["fact_warehouse_inventory"]
],
"sources": [],
"description": "",
"columns": {},
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"build_path": "target/compiled/dbt_amundsen_demo/models/finance/fact_daily_expenses.sql",
"deferred": false,
"unrendered_config": {
"alias": "cost_summary",
"schema": "PUBLIC",
"tags": ["finance", "certified"],
"comment": "this is a comment"
},
"compiled_sql": "\n\n\nselect\n inv_wh.dt as dt,\n inventory_cost\nfrom DBT_AMUNDSEN_DEMO.DBT_AMUNDSEN.fact_warehouse_inventory inv_wh",
"extra_ctes_injected": true,
"extra_ctes": [],
"relation_name": "DBT_AMUNDSEN_DEMO.DBT_AMUNDSEN.cost_summary"
},
"test.dbt_amundsen_demo.unique_fact_catalog_returns_cr_item_sk": {
"raw_sql": "{{ config(severity='ERROR') }}{{ test_unique(**_dbt_schema_test_kwargs) }}",
"test_metadata": {
"name": "unique",
"kwargs": {
"column_name": "cr_item_sk",
"model": "{{ ref('fact_catalog_returns') }}"
},
"namespace": null
},
"compiled": true,
"resource_type": "test",
"depends_on": {
"macros": ["macro.dbt.test_unique"],
"nodes": ["model.dbt_amundsen_demo.fact_catalog_returns"]
},
"config": {
"enabled": true,
"materialized": "test",
"persist_docs": {},
"vars": {},
"quoting": {},
"column_types": {},
"alias": null,
"schema": null,
"database": null,
"tags": [],
"full_refresh": null,
"severity": "ERROR",
"post-hook": [],
"pre-hook": []
},
"database": "DBT_AMUNDSEN_DEMO",
"schema": "PUBLIC",
"fqn": ["dbt_amundsen_demo", "schema_test", "unique_fact_catalog_returns_cr_item_sk"],
"unique_id": "test.dbt_amundsen_demo.unique_fact_catalog_returns_cr_item_sk",
"package_name": "dbt_amundsen_demo",
"root_path": "/Users/grantseward/GitHub/dbt_amundsen_demo",
"path": "schema_test/unique_fact_catalog_returns_cr_item_sk.sql",
"original_file_path": "models/call_center/schema.yml",
"name": "unique_fact_catalog_returns_cr_item_sk",
"alias": "unique_fact_catalog_returns_cr_item_sk",
"checksum": {
"name": "none",
"checksum": ""
},
"tags": ["schema"],
"refs": [
["fact_catalog_returns"]
],
"sources": [],
"description": "",
"columns": {},
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"build_path": "target/compiled/dbt_amundsen_demo/models/call_center/schema.yml/schema_test/unique_fact_catalog_returns_cr_item_sk.sql",
"deferred": false,
"unrendered_config": {
"severity": "ERROR"
},
"compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom (\n\n select\n cr_item_sk\n\n from DBT_AMUNDSEN_DEMO.DBT_AMUNDSEN.fact_catalog_returns\n where cr_item_sk is not null\n group by cr_item_sk\n having count(*) > 1\n\n) validation_errors\n\n\n",
"extra_ctes_injected": true,
"extra_ctes": [],
"relation_name": null,
"column_name": "cr_item_sk"
},
"test.dbt_amundsen_demo.not_null_fact_catalog_returns_cr_item_sk": {
"raw_sql": "{{ config(severity='ERROR') }}{{ test_not_null(**_dbt_schema_test_kwargs) }}",
"test_metadata": {
"name": "not_null",
"kwargs": {
"column_name": "cr_item_sk",
"model": "{{ ref('fact_catalog_returns') }}"
},
"namespace": null
},
"compiled": true,
"resource_type": "test",
"depends_on": {
"macros": ["macro.dbt.test_not_null"],
"nodes": ["model.dbt_amundsen_demo.fact_catalog_returns"]
},
"config": {
"enabled": true,
"materialized": "test",
"persist_docs": {},
"vars": {},
"quoting": {},
"column_types": {},
"alias": null,
"schema": null,
"database": null,
"tags": [],
"full_refresh": null,
"severity": "ERROR",
"post-hook": [],
"pre-hook": []
},
"database": "DBT_AMUNDSEN_DEMO",
"schema": "DBT_AMUNDSEN",
"fqn": ["dbt_amundsen_demo", "schema_test", "not_null_fact_catalog_returns_cr_item_sk"],
"unique_id": "test.dbt_amundsen_demo.not_null_fact_catalog_returns_cr_item_sk",
"package_name": "dbt_amundsen_demo",
"root_path": "/Users/grantseward/GitHub/dbt_amundsen_demo",
"path": "schema_test/not_null_fact_catalog_returns_cr_item_sk.sql",
"original_file_path": "models/call_center/schema.yml",
"name": "not_null_fact_catalog_returns_cr_item_sk",
"alias": "not_null_fact_catalog_returns_cr_item_sk",
"checksum": {
"name": "none",
"checksum": ""
},
"tags": ["schema"],
"refs": [
["fact_catalog_returns"]
],
"sources": [],
"description": "",
"columns": {},
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"build_path": "target/compiled/dbt_amundsen_demo/models/call_center/schema.yml/schema_test/not_null_fact_catalog_returns_cr_item_sk.sql",
"deferred": false,
"unrendered_config": {
"severity": "ERROR"
},
"compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom DBT_AMUNDSEN_DEMO.DBT_AMUNDSEN.fact_catalog_returns\nwhere cr_item_sk is null\n\n\n",
"extra_ctes_injected": true,
"extra_ctes": [],
"relation_name": null,
"column_name": "cr_item_sk"
},
"test.dbt_amundsen_demo.unique_fact_third_party_performance_company_id": {
"raw_sql": "{{ config(severity='ERROR') }}{{ test_unique(**_dbt_schema_test_kwargs) }}",
"test_metadata": {
"name": "unique",
"kwargs": {
"column_name": "company_id",
"model": "{{ ref('fact_third_party_performance') }}"
},
"namespace": null
},
"compiled": true,
"resource_type": "test",
"depends_on": {
"macros": ["macro.dbt.test_unique"],
"nodes": ["model.dbt_amundsen_demo.fact_third_party_performance"]
},
"config": {
"enabled": true,
"materialized": "test",
"persist_docs": {},
"vars": {},
"quoting": {},
"column_types": {},
"alias": null,
"schema": null,
"database": null,
"tags": [],
"full_refresh": null,
"severity": "ERROR",
"post-hook": [],
"pre-hook": []
},
"database": "DBT_AMUNDSEN_DEMO",
"schema": "PUBLIC",
"fqn": ["dbt_amundsen_demo", "schema_test", "unique_fact_third_party_performance_company_id"],
"unique_id": "test.dbt_amundsen_demo.unique_fact_third_party_performance_company_id",
"package_name": "dbt_amundsen_demo",
"root_path": "/Users/grantseward/GitHub/dbt_amundsen_demo",
"path": "schema_test/unique_fact_third_party_performance_company_id.sql",
"original_file_path": "models/call_center/schema.yml",
"name": "unique_fact_third_party_performance_company_id",
"alias": "unique_fact_third_party_performance_company_id",
"checksum": {
"name": "none",
"checksum": ""
},
"tags": ["column_tag", "goes_here", "schema"],
"refs": [
["fact_third_party_performance"]
],
"sources": [],
"description": "",
"columns": {},
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"build_path": "target/compiled/dbt_amundsen_demo/models/call_center/schema.yml/schema_test/unique_fact_third_party_performance_company_id.sql",
"deferred": false,
"unrendered_config": {
"severity": "ERROR"
},
"compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom (\n\n select\n company_id\n\n from DBT_AMUNDSEN_DEMO.DBT_AMUNDSEN.fact_third_party_performance\n where company_id is not null\n group by company_id\n having count(*) > 1\n\n) validation_errors\n\n\n",
"extra_ctes_injected": true,
"extra_ctes": [],
"relation_name": null,
"column_name": "company_id"
},
"test.dbt_amundsen_demo.not_null_fact_third_party_performance_company_id": {
"raw_sql": "{{ config(severity='ERROR') }}{{ test_not_null(**_dbt_schema_test_kwargs) }}",
"test_metadata": {
"name": "not_null",
"kwargs": {
"column_name": "company_id",
"model": "{{ ref('fact_third_party_performance') }}"
},
"namespace": null
},
"compiled": true,
"resource_type": "test",
"depends_on": {
"macros": ["macro.dbt.test_not_null"],
"nodes": ["model.dbt_amundsen_demo.fact_third_party_performance"]
},
"config": {
"enabled": true,
"materialized": "test",
"persist_docs": {},
"vars": {},
"quoting": {},
"column_types": {},
"alias": null,
"schema": null,
"database": null,
"tags": [],
"full_refresh": null,
"severity": "ERROR",
"post-hook": [],
"pre-hook": []
},
"database": "DBT_AMUNDSEN_DEMO",
"schema": "PUBLIC",
"fqn": ["dbt_amundsen_demo", "schema_test", "not_null_fact_third_party_performance_company_id"],
"unique_id": "test.dbt_amundsen_demo.not_null_fact_third_party_performance_company_id",
"package_name": "dbt_amundsen_demo",
"root_path": "/Users/grantseward/GitHub/dbt_amundsen_demo",
"path": "schema_test/not_null_fact_third_party_performance_company_id.sql",
"original_file_path": "models/call_center/schema.yml",
"name": "not_null_fact_third_party_performance_company_id",
"alias": "not_null_fact_third_party_performance_company_id",
"checksum": {
"name": "none",
"checksum": ""
},
"tags": ["column_tag", "goes_here", "schema"],
"refs": [
["fact_third_party_performance"]
],
"sources": [],
"description": "",
"columns": {},
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"build_path": "target/compiled/dbt_amundsen_demo/models/call_center/schema.yml/schema_test/not_null_fact_third_party_performance_company_id.sql",
"deferred": false,
"unrendered_config": {
"severity": "ERROR"
},
"compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom DBT_AMUNDSEN_DEMO.DBT_AMUNDSEN.fact_third_party_performance\nwhere company_id is null\n\n\n",
"extra_ctes_injected": true,
"extra_ctes": [],
"relation_name": null,
"column_name": "company_id"
},
"test.dbt_amundsen_demo.unique_fact_third_party_performance_company_name": {
"raw_sql": "{{ config(severity='ERROR') }}{{ test_unique(**_dbt_schema_test_kwargs) }}",
"test_metadata": {
"name": "unique",
"kwargs": {
"column_name": "company_name",
"model": "{{ ref('fact_third_party_performance') }}"
},
"namespace": null
},
"compiled": true,
"resource_type": "test",
"depends_on": {
"macros": ["macro.dbt.test_unique"],
"nodes": ["model.dbt_amundsen_demo.fact_third_party_performance"]
},
"config": {
"enabled": true,
"materialized": "test",
"persist_docs": {},
"vars": {},
"quoting": {},
"column_types": {},
"alias": null,
"schema": null,
"database": null,
"tags": [],
"full_refresh": null,
"severity": "ERROR",
"post-hook": [],
"pre-hook": []
},
"database": "DBT_AMUNDSEN_DEMO",
"schema": "PUBLIC",
"fqn": ["dbt_amundsen_demo", "schema_test", "unique_fact_third_party_performance_company_name"],
"unique_id": "test.dbt_amundsen_demo.unique_fact_third_party_performance_company_name",
"package_name": "dbt_amundsen_demo",
"root_path": "/Users/grantseward/GitHub/dbt_amundsen_demo",
"path": "schema_test/unique_fact_third_party_performance_company_name.sql",
"original_file_path": "models/call_center/schema.yml",
"name": "unique_fact_third_party_performance_company_name",
"alias": "unique_fact_third_party_performance_company_name",
"checksum": {
"name": "none",
"checksum": ""
},
"tags": ["schema"],
"refs": [
["fact_third_party_performance"]
],
"sources": [],
"description": "",
"columns": {},
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"build_path": "target/compiled/dbt_amundsen_demo/models/call_center/schema.yml/schema_test/unique_fact_third_party_performance_company_name.sql",
"deferred": false,
"unrendered_config": {
"severity": "ERROR"
},
"compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom (\n\n select\n company_name\n\n from DBT_AMUNDSEN_DEMO.DBT_AMUNDSEN.fact_third_party_performance\n where company_name is not null\n group by company_name\n having count(*) > 1\n\n) validation_errors\n\n\n",
"extra_ctes_injected": true,
"extra_ctes": [],
"relation_name": null,
"column_name": "company_name"
},
"test.dbt_amundsen_demo.not_null_fact_third_party_performance_company_name": {
"raw_sql": "{{ config(severity='ERROR') }}{{ test_not_null(**_dbt_schema_test_kwargs) }}",
"test_metadata": {
"name": "not_null",
"kwargs": {
"column_name": "company_name",
"model": "{{ ref('fact_third_party_performance') }}"
},
"namespace": null
},
"compiled": true,
"resource_type": "test",
"depends_on": {
"macros": ["macro.dbt.test_not_null"],
"nodes": ["model.dbt_amundsen_demo.fact_third_party_performance"]
},
"config": {
"enabled": true,
"materialized": "test",
"persist_docs": {},
"vars": {},
"quoting": {},
"column_types": {},
"alias": null,
"schema": null,
"database": null,
"tags": [],
"full_refresh": null,
"severity": "ERROR",
"post-hook": [],
"pre-hook": []
},
"database": "DBT_AMUNDSEN_DEMO",
"schema": "PUBLIC",
"fqn": ["dbt_amundsen_demo", "schema_test", "not_null_fact_third_party_performance_company_name"],
"unique_id": "test.dbt_amundsen_demo.not_null_fact_third_party_performance_company_name",
"package_name": "dbt_amundsen_demo",
"root_path": "/Users/grantseward/GitHub/dbt_amundsen_demo",
"path": "schema_test/not_null_fact_third_party_performance_company_name.sql",
"original_file_path": "models/call_center/schema.yml",
"name": "not_null_fact_third_party_performance_company_name",
"alias": "not_null_fact_third_party_performance_company_name",
"checksum": {
"name": "none",
"checksum": ""
},
"tags": ["schema"],
"refs": [
["fact_third_party_performance"]
],
"sources": [],
"description": "",
"columns": {},
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"build_path": "target/compiled/dbt_amundsen_demo/models/call_center/schema.yml/schema_test/not_null_fact_third_party_performance_company_name.sql",
"deferred": false,
"unrendered_config": {
"severity": "ERROR"
},
"compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom DBT_AMUNDSEN_DEMO.DBT_AMUNDSEN.fact_third_party_performance\nwhere company_name is null\n\n\n",
"extra_ctes_injected": true,
"extra_ctes": [],
"relation_name": null,
"column_name": "company_name"
}
},
"sources": {},
"macros": {
"macro.dbt_snowflake.snowflake__get_catalog": {
"unique_id": "macro.dbt_snowflake.snowflake__get_catalog",
"package_name": "dbt_snowflake",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/snowflake",
"path": "macros/catalog.sql",
"original_file_path": "macros/catalog.sql",
"name": "snowflake__get_catalog",
"macro_sql": "{% macro snowflake__get_catalog(information_schema, schemas) -%}\n {% set query %}\n with tables as (\n\n select\n table_catalog as \"table_database\",\n table_schema as \"table_schema\",\n table_name as \"table_name\",\n table_type as \"table_type\",\n comment as \"table_comment\",\n\n -- note: this is the _role_ that owns the table\n table_owner as \"table_owner\",\n\n 'Clustering Key' as \"stats:clustering_key:label\",\n clustering_key as \"stats:clustering_key:value\",\n 'The key used to cluster this table' as \"stats:clustering_key:description\",\n (clustering_key is not null) as \"stats:clustering_key:include\",\n\n 'Row Count' as \"stats:row_count:label\",\n row_count as \"stats:row_count:value\",\n 'An approximate count of rows in this table' as \"stats:row_count:description\",\n (row_count is not null) as \"stats:row_count:include\",\n\n 'Approximate Size' as \"stats:bytes:label\",\n bytes as \"stats:bytes:value\",\n 'Approximate size of the table as reported by Snowflake' as \"stats:bytes:description\",\n (bytes is not null) as \"stats:bytes:include\",\n\n 'Last Modified' as \"stats:last_modified:label\",\n to_varchar(convert_timezone('UTC', last_altered), 'yyyy-mm-dd HH24:MI'||'UTC') as \"stats:last_modified:value\",\n 'The timestamp for last update/change' as \"stats:last_modified:description\",\n (last_altered is not null and table_type='BASE TABLE') as \"stats:last_modified:include\"\n\n from {{ information_schema }}.tables\n\n ),\n\n columns as (\n\n select\n table_catalog as \"table_database\",\n table_schema as \"table_schema\",\n table_name as \"table_name\",\n\n column_name as \"column_name\",\n ordinal_position as \"column_index\",\n data_type as \"column_type\",\n comment as \"column_comment\"\n\n from {{ information_schema }}.columns\n )\n\n select *\n from tables\n join columns using (\"table_database\", \"table_schema\", \"table_name\")\n where (\n {%- for schema in schemas -%}\n upper(\"table_schema\") = upper('{{ schema }}'){%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n )\n order by \"column_index\"\n {%- endset -%}\n\n {{ return(run_query(query)) }}\n\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt_snowflake.snowflake__create_table_as": {
"unique_id": "macro.dbt_snowflake.snowflake__create_table_as",
"package_name": "dbt_snowflake",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/snowflake",
"path": "macros/adapters.sql",
"original_file_path": "macros/adapters.sql",
"name": "snowflake__create_table_as",
"macro_sql": "{% macro snowflake__create_table_as(temporary, relation, sql) -%}\n {%- set transient = config.get('transient', default=true) -%}\n {%- set cluster_by_keys = config.get('cluster_by', default=none) -%}\n {%- set enable_automatic_clustering = config.get('automatic_clustering', default=false) -%}\n {%- set copy_grants = config.get('copy_grants', default=false) -%}\n\n {%- if cluster_by_keys is not none and cluster_by_keys is string -%}\n {%- set cluster_by_keys = [cluster_by_keys] -%}\n {%- endif -%}\n {%- if cluster_by_keys is not none -%}\n {%- set cluster_by_string = cluster_by_keys|join(\", \")-%}\n {% else %}\n {%- set cluster_by_string = none -%}\n {%- endif -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n\n create or replace {% if temporary -%}\n temporary\n {%- elif transient -%}\n transient\n {%- endif %} table {{ relation }} {% if copy_grants and not temporary -%} copy grants {%- endif %} as\n (\n {%- if cluster_by_string is not none -%}\n select * from(\n {{ sql }}\n ) order by ({{ cluster_by_string }})\n {%- else -%}\n {{ sql }}\n {%- endif %}\n );\n {% if cluster_by_string is not none and not temporary -%}\n alter table {{relation}} cluster by ({{cluster_by_string}});\n {%- endif -%}\n {% if enable_automatic_clustering and cluster_by_string is not none and not temporary -%}\n alter table {{relation}} resume recluster;\n {%- endif -%}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt_snowflake.snowflake__create_view_as": {
"unique_id": "macro.dbt_snowflake.snowflake__create_view_as",
"package_name": "dbt_snowflake",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/snowflake",
"path": "macros/adapters.sql",
"original_file_path": "macros/adapters.sql",
"name": "snowflake__create_view_as",
"macro_sql": "{% macro snowflake__create_view_as(relation, sql) -%}\n {%- set secure = config.get('secure', default=false) -%}\n {%- set copy_grants = config.get('copy_grants', default=false) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n create or replace {% if secure -%}\n secure\n {%- endif %} view {{ relation }} {% if copy_grants -%} copy grants {%- endif %} as (\n {{ sql }}\n );\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt_snowflake.snowflake__get_columns_in_relation": {
"unique_id": "macro.dbt_snowflake.snowflake__get_columns_in_relation",
"package_name": "dbt_snowflake",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/snowflake",
"path": "macros/adapters.sql",
"original_file_path": "macros/adapters.sql",
"name": "snowflake__get_columns_in_relation",
"macro_sql": "{% macro snowflake__get_columns_in_relation(relation) -%}\n {%- set sql -%}\n describe table {{ relation }}\n {%- endset -%}\n {%- set result = run_query(sql) -%}\n\n {% set maximum = 10000 %}\n {% if (result | length) >= maximum %}\n {% set msg %}\n Too many columns in relation {{ relation }}! dbt can only get\n information about relations with fewer than {{ maximum }} columns.\n {% endset %}\n {% do exceptions.raise_compiler_error(msg) %}\n {% endif %}\n\n {% set columns = [] %}\n {% for row in result %}\n {% do columns.append(api.Column.from_description(row['name'], row['type'])) %}\n {% endfor %}\n {% do return(columns) %}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt_snowflake.snowflake__list_schemas": {
"unique_id": "macro.dbt_snowflake.snowflake__list_schemas",
"package_name": "dbt_snowflake",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/snowflake",
"path": "macros/adapters.sql",
"original_file_path": "macros/adapters.sql",
"name": "snowflake__list_schemas",
"macro_sql": "{% macro snowflake__list_schemas(database) -%}\n {# 10k limit from here: https://docs.snowflake.net/manuals/sql-reference/sql/show-schemas.html#usage-notes #}\n {% set maximum = 10000 %}\n {% set sql -%}\n show terse schemas in database {{ database }}\n limit {{ maximum }}\n {%- endset %}\n {% set result = run_query(sql) %}\n {% if (result | length) >= maximum %}\n {% set msg %}\n Too many schemas in database {{ database }}! dbt can only get\n information about databases with fewer than {{ maximum }} schemas.\n {% endset %}\n {% do exceptions.raise_compiler_error(msg) %}\n {% endif %}\n {{ return(result) }}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt_snowflake.snowflake__list_relations_without_caching": {
"unique_id": "macro.dbt_snowflake.snowflake__list_relations_without_caching",
"package_name": "dbt_snowflake",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/snowflake",
"path": "macros/adapters.sql",
"original_file_path": "macros/adapters.sql",
"name": "snowflake__list_relations_without_caching",
"macro_sql": "{% macro snowflake__list_relations_without_caching(schema_relation) %}\n {%- set sql -%}\n show terse objects in {{ schema_relation }}\n {%- endset -%}\n\n {%- set result = run_query(sql) -%}\n {% set maximum = 10000 %}\n {% if (result | length) >= maximum %}\n {% set msg %}\n Too many schemas in schema {{ schema_relation }}! dbt can only get\n information about schemas with fewer than {{ maximum }} objects.\n {% endset %}\n {% do exceptions.raise_compiler_error(msg) %}\n {% endif %}\n {%- do return(result) -%}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt_snowflake.snowflake__check_schema_exists": {
"unique_id": "macro.dbt_snowflake.snowflake__check_schema_exists",
"package_name": "dbt_snowflake",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/snowflake",
"path": "macros/adapters.sql",
"original_file_path": "macros/adapters.sql",
"name": "snowflake__check_schema_exists",
"macro_sql": "{% macro snowflake__check_schema_exists(information_schema, schema) -%}\n {% call statement('check_schema_exists', fetch_result=True) -%}\n select count(*)\n from {{ information_schema }}.schemata\n where upper(schema_name) = upper('{{ schema }}')\n and upper(catalog_name) = upper('{{ information_schema.database }}')\n {%- endcall %}\n {{ return(load_result('check_schema_exists').table) }}\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt_snowflake.snowflake__current_timestamp": {
"unique_id": "macro.dbt_snowflake.snowflake__current_timestamp",
"package_name": "dbt_snowflake",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/snowflake",
"path": "macros/adapters.sql",
"original_file_path": "macros/adapters.sql",
"name": "snowflake__current_timestamp",
"macro_sql": "{% macro snowflake__current_timestamp() -%}\n convert_timezone('UTC', current_timestamp())\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt_snowflake.snowflake__snapshot_string_as_time": {
"unique_id": "macro.dbt_snowflake.snowflake__snapshot_string_as_time",
"package_name": "dbt_snowflake",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/snowflake",
"path": "macros/adapters.sql",
"original_file_path": "macros/adapters.sql",
"name": "snowflake__snapshot_string_as_time",
"macro_sql": "{% macro snowflake__snapshot_string_as_time(timestamp) -%}\n {%- set result = \"to_timestamp_ntz('\" ~ timestamp ~ \"')\" -%}\n {{ return(result) }}\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt_snowflake.snowflake__snapshot_get_time": {
"unique_id": "macro.dbt_snowflake.snowflake__snapshot_get_time",
"package_name": "dbt_snowflake",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/snowflake",
"path": "macros/adapters.sql",
"original_file_path": "macros/adapters.sql",
"name": "snowflake__snapshot_get_time",
"macro_sql": "{% macro snowflake__snapshot_get_time() -%}\n to_timestamp_ntz({{ current_timestamp() }})\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt_snowflake.snowflake__rename_relation": {
"unique_id": "macro.dbt_snowflake.snowflake__rename_relation",
"package_name": "dbt_snowflake",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/snowflake",
"path": "macros/adapters.sql",
"original_file_path": "macros/adapters.sql",
"name": "snowflake__rename_relation",
"macro_sql": "{% macro snowflake__rename_relation(from_relation, to_relation) -%}\n {% call statement('rename_relation') -%}\n alter table {{ from_relation }} rename to {{ to_relation }}\n {%- endcall %}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt_snowflake.snowflake__alter_column_type": {
"unique_id": "macro.dbt_snowflake.snowflake__alter_column_type",
"package_name": "dbt_snowflake",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/snowflake",
"path": "macros/adapters.sql",
"original_file_path": "macros/adapters.sql",
"name": "snowflake__alter_column_type",
"macro_sql": "{% macro snowflake__alter_column_type(relation, column_name, new_column_type) -%}\n {% call statement('alter_column_type') %}\n alter table {{ relation }} alter {{ adapter.quote(column_name) }} set data type {{ new_column_type }};\n {% endcall %}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt_snowflake.snowflake__alter_relation_comment": {
"unique_id": "macro.dbt_snowflake.snowflake__alter_relation_comment",
"package_name": "dbt_snowflake",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/snowflake",
"path": "macros/adapters.sql",
"original_file_path": "macros/adapters.sql",
"name": "snowflake__alter_relation_comment",
"macro_sql": "{% macro snowflake__alter_relation_comment(relation, relation_comment) -%}\n comment on {{ relation.type }} {{ relation }} IS $${{ relation_comment | replace('$', '[$]') }}$$;\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt_snowflake.snowflake__alter_column_comment": {
"unique_id": "macro.dbt_snowflake.snowflake__alter_column_comment",
"package_name": "dbt_snowflake",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/snowflake",
"path": "macros/adapters.sql",
"original_file_path": "macros/adapters.sql",
"name": "snowflake__alter_column_comment",
"macro_sql": "{% macro snowflake__alter_column_comment(relation, column_dict) -%}\n alter {{ relation.type }} {{ relation }} alter\n {% for column_name in column_dict %}\n {{ adapter.quote(column_name) if column_dict[column_name]['quote'] else column_name }} COMMENT $${{ column_dict[column_name]['description'] | replace('$', '[$]') }}$$ {{ ',' if not loop.last else ';' }}\n {% endfor %}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt_snowflake.get_current_query_tag": {
"unique_id": "macro.dbt_snowflake.get_current_query_tag",
"package_name": "dbt_snowflake",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/snowflake",
"path": "macros/adapters.sql",
"original_file_path": "macros/adapters.sql",
"name": "get_current_query_tag",
"macro_sql": "{% macro get_current_query_tag() -%}\n {{ return(run_query(\"show parameters like 'query_tag' in session\").rows[0]['value']) }}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt_snowflake.set_query_tag": {
"unique_id": "macro.dbt_snowflake.set_query_tag",
"package_name": "dbt_snowflake",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/snowflake",
"path": "macros/adapters.sql",
"original_file_path": "macros/adapters.sql",
"name": "set_query_tag",
"macro_sql": "{% macro set_query_tag() -%}\n {% set new_query_tag = config.get('query_tag') %}\n {% if new_query_tag %}\n {% set original_query_tag = get_current_query_tag() %}\n {{ log(\"Setting query_tag to '\" ~ new_query_tag ~ \"'. Will reset to '\" ~ original_query_tag ~ \"' after materialization.\") }}\n {% do run_query(\"alter session set query_tag = '{}'\".format(new_query_tag)) %}\n {{ return(original_query_tag)}}\n {% endif %}\n {{ return(none)}}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt_snowflake.unset_query_tag": {
"unique_id": "macro.dbt_snowflake.unset_query_tag",
"package_name": "dbt_snowflake",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/snowflake",
"path": "macros/adapters.sql",
"original_file_path": "macros/adapters.sql",
"name": "unset_query_tag",
"macro_sql": "{% macro unset_query_tag(original_query_tag) -%}\n {% set new_query_tag = config.get('query_tag') %}\n {% if new_query_tag %}\n {% if original_query_tag %}\n {{ log(\"Resetting query_tag to '\" ~ original_query_tag ~ \"'.\") }}\n {% do run_query(\"alter session set query_tag = '{}'\".format(original_query_tag)) %}\n {% else %}\n {{ log(\"No original query_tag, unsetting parameter.\") }}\n {% do run_query(\"alter session unset query_tag\") %}\n {% endif %}\n {% endif %}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt_snowflake.snowflake__get_merge_sql": {
"unique_id": "macro.dbt_snowflake.snowflake__get_merge_sql",
"package_name": "dbt_snowflake",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/snowflake",
"path": "macros/materializations/merge.sql",
"original_file_path": "macros/materializations/merge.sql",
"name": "snowflake__get_merge_sql",
"macro_sql": "{% macro snowflake__get_merge_sql(target, source_sql, unique_key, dest_columns, predicates) -%}\n\n {#\n Workaround for Snowflake not being happy with a merge on a constant-false predicate.\n When no unique_key is provided, this macro will do a regular insert. If a unique_key\n is provided, then this macro will do a proper merge instead.\n #}\n\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute='name')) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {%- if unique_key is none -%}\n\n {{ sql_header if sql_header is not none }}\n\n insert into {{ target }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ source_sql }}\n );\n\n {%- else -%}\n\n {{ default__get_merge_sql(target, source_sql, unique_key, dest_columns, predicates) }}\n\n {%- endif -%}\n\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt_snowflake.materialization_view_snowflake": {
"unique_id": "macro.dbt_snowflake.materialization_view_snowflake",
"package_name": "dbt_snowflake",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/snowflake",
"path": "macros/materializations/view.sql",
"original_file_path": "macros/materializations/view.sql",
"name": "materialization_view_snowflake",
"macro_sql": "{% materialization view, adapter='snowflake' -%}\n\n {% set original_query_tag = set_query_tag() %}\n {% set to_return = create_or_replace_view() %}\n\n {% set target_relation = this.incorporate(type='view') %}\n {% do persist_docs(target_relation, model, for_columns=false) %}\n\n {% do return(to_return) %}\n\n {% do unset_query_tag(original_query_tag) %}\n\n{%- endmaterialization %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt_snowflake.materialization_table_snowflake": {
"unique_id": "macro.dbt_snowflake.materialization_table_snowflake",
"package_name": "dbt_snowflake",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/snowflake",
"path": "macros/materializations/table.sql",
"original_file_path": "macros/materializations/table.sql",
"name": "materialization_table_snowflake",
"macro_sql": "{% materialization table, adapter='snowflake' %}\n\n {% set original_query_tag = set_query_tag() %}\n\n {%- set identifier = model['alias'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier,\n schema=schema,\n database=database, type='table') -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {#-- Drop the relation if it was a view to \"convert\" it in a table. This may lead to\n -- downtime, but it should be a relatively infrequent occurrence #}\n {% if old_relation is not none and not old_relation.is_table %}\n {{ log(\"Dropping relation \" ~ old_relation ~ \" because it is of type \" ~ old_relation.type) }}\n {{ drop_relation_if_exists(old_relation) }}\n {% endif %}\n\n --build model\n {% call statement('main') -%}\n {{ create_table_as(false, target_relation, sql) }}\n {%- endcall %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {% do persist_docs(target_relation, model) %}\n\n {% do unset_query_tag(original_query_tag) %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt_snowflake.dbt_snowflake_validate_get_incremental_strategy": {
"unique_id": "macro.dbt_snowflake.dbt_snowflake_validate_get_incremental_strategy",
"package_name": "dbt_snowflake",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/snowflake",
"path": "macros/materializations/incremental.sql",
"original_file_path": "macros/materializations/incremental.sql",
"name": "dbt_snowflake_validate_get_incremental_strategy",
"macro_sql": "{% macro dbt_snowflake_validate_get_incremental_strategy(config) %}\n {#-- Find and validate the incremental strategy #}\n {%- set strategy = config.get(\"incremental_strategy\", default=\"merge\") -%}\n\n {% set invalid_strategy_msg -%}\n Invalid incremental strategy provided: {{ strategy }}\n Expected one of: 'merge', 'delete+insert'\n {%- endset %}\n {% if strategy not in ['merge', 'delete+insert'] %}\n {% do exceptions.raise_compiler_error(invalid_strategy_msg) %}\n {% endif %}\n\n {% do return(strategy) %}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt_snowflake.dbt_snowflake_get_incremental_sql": {
"unique_id": "macro.dbt_snowflake.dbt_snowflake_get_incremental_sql",
"package_name": "dbt_snowflake",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/snowflake",
"path": "macros/materializations/incremental.sql",
"original_file_path": "macros/materializations/incremental.sql",
"name": "dbt_snowflake_get_incremental_sql",
"macro_sql": "{% macro dbt_snowflake_get_incremental_sql(strategy, tmp_relation, target_relation, unique_key, dest_columns) %}\n {% if strategy == 'merge' %}\n {% do return(get_merge_sql(target_relation, tmp_relation, unique_key, dest_columns)) %}\n {% elif strategy == 'delete+insert' %}\n {% do return(get_delete_insert_merge_sql(target_relation, tmp_relation, unique_key, dest_columns)) %}\n {% else %}\n {% do exceptions.raise_compiler_error('invalid strategy: ' ~ strategy) %}\n {% endif %}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt_snowflake.materialization_incremental_snowflake": {
"unique_id": "macro.dbt_snowflake.materialization_incremental_snowflake",
"package_name": "dbt_snowflake",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/snowflake",
"path": "macros/materializations/incremental.sql",
"original_file_path": "macros/materializations/incremental.sql",
"name": "materialization_incremental_snowflake",
"macro_sql": "{% materialization incremental, adapter='snowflake' -%}\n\n {% set original_query_tag = set_query_tag() %}\n\n {%- set unique_key = config.get('unique_key') -%}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {% set target_relation = this %}\n {% set existing_relation = load_relation(this) %}\n {% set tmp_relation = make_temp_relation(this) %}\n\n {#-- Validate early so we don't run SQL if the strategy is invalid --#}\n {% set strategy = dbt_snowflake_validate_get_incremental_strategy(config) -%}\n\n -- setup\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% if existing_relation is none %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n {% elif existing_relation.is_view %}\n {#-- Can't overwrite a view with a table - we must drop --#}\n {{ log(\"Dropping relation \" ~ target_relation ~ \" because it is a view and this model is a table.\") }}\n {% do adapter.drop_relation(existing_relation) %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n {% elif full_refresh_mode %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n {% else %}\n {% do run_query(create_table_as(True, tmp_relation, sql)) %}\n {% do adapter.expand_target_column_types(\n from_relation=tmp_relation,\n to_relation=target_relation) %}\n {% set dest_columns = adapter.get_columns_in_relation(target_relation) %}\n {% set build_sql = dbt_snowflake_get_incremental_sql(strategy, tmp_relation, target_relation, unique_key, dest_columns) %}\n {% endif %}\n\n {%- call statement('main') -%}\n {{ build_sql }}\n {%- endcall -%}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {% set target_relation = target_relation.incorporate(type='table') %}\n {% do persist_docs(target_relation, model) %}\n\n {% do unset_query_tag(original_query_tag) %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.statement": {
"unique_id": "macro.dbt.statement",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/core.sql",
"original_file_path": "macros/core.sql",
"name": "statement",
"macro_sql": "{% macro statement(name=None, fetch_result=False, auto_begin=True) -%}\n {%- if execute: -%}\n {%- set sql = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n {{ write(sql) }}\n {%- endif -%}\n\n {%- set res, table = adapter.execute(sql, auto_begin=auto_begin, fetch=fetch_result) -%}\n {%- if name is not none -%}\n {{ store_result(name, response=res, agate_table=table) }}\n {%- endif -%}\n\n {%- endif -%}\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.noop_statement": {
"unique_id": "macro.dbt.noop_statement",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/core.sql",
"original_file_path": "macros/core.sql",
"name": "noop_statement",
"macro_sql": "{% macro noop_statement(name=None, message=None, code=None, rows_affected=None, res=None) -%}\n {%- set sql = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n {{ write(sql) }}\n {%- endif -%}\n\n {%- if name is not none -%}\n {{ store_raw_result(name, message=message, code=code, rows_affected=rows_affected, agate_table=res) }}\n {%- endif -%}\n\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.run_hooks": {
"unique_id": "macro.dbt.run_hooks",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/helpers.sql",
"original_file_path": "macros/materializations/helpers.sql",
"name": "run_hooks",
"macro_sql": "{% macro run_hooks(hooks, inside_transaction=True) %}\n {% for hook in hooks | selectattr('transaction', 'equalto', inside_transaction) %}\n {% if not inside_transaction and loop.first %}\n {% call statement(auto_begin=inside_transaction) %}\n commit;\n {% endcall %}\n {% endif %}\n {% set rendered = render(hook.get('sql')) | trim %}\n {% if (rendered | length) > 0 %}\n {% call statement(auto_begin=inside_transaction) %}\n {{ rendered }}\n {% endcall %}\n {% endif %}\n {% endfor %}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.column_list": {
"unique_id": "macro.dbt.column_list",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/helpers.sql",
"original_file_path": "macros/materializations/helpers.sql",
"name": "column_list",
"macro_sql": "{% macro column_list(columns) %}\n {%- for col in columns %}\n {{ col.name }} {% if not loop.last %},{% endif %}\n {% endfor -%}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.column_list_for_create_table": {
"unique_id": "macro.dbt.column_list_for_create_table",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/helpers.sql",
"original_file_path": "macros/materializations/helpers.sql",
"name": "column_list_for_create_table",
"macro_sql": "{% macro column_list_for_create_table(columns) %}\n {%- for col in columns %}\n {{ col.name }} {{ col.data_type }} {%- if not loop.last %},{% endif %}\n {% endfor -%}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.make_hook_config": {
"unique_id": "macro.dbt.make_hook_config",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/helpers.sql",
"original_file_path": "macros/materializations/helpers.sql",
"name": "make_hook_config",
"macro_sql": "{% macro make_hook_config(sql, inside_transaction) %}\n {{ tojson({\"sql\": sql, \"transaction\": inside_transaction}) }}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.before_begin": {
"unique_id": "macro.dbt.before_begin",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/helpers.sql",
"original_file_path": "macros/materializations/helpers.sql",
"name": "before_begin",
"macro_sql": "{% macro before_begin(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.in_transaction": {
"unique_id": "macro.dbt.in_transaction",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/helpers.sql",
"original_file_path": "macros/materializations/helpers.sql",
"name": "in_transaction",
"macro_sql": "{% macro in_transaction(sql) %}\n {{ make_hook_config(sql, inside_transaction=True) }}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.after_commit": {
"unique_id": "macro.dbt.after_commit",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/helpers.sql",
"original_file_path": "macros/materializations/helpers.sql",
"name": "after_commit",
"macro_sql": "{% macro after_commit(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.drop_relation_if_exists": {
"unique_id": "macro.dbt.drop_relation_if_exists",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/helpers.sql",
"original_file_path": "macros/materializations/helpers.sql",
"name": "drop_relation_if_exists",
"macro_sql": "{% macro drop_relation_if_exists(relation) %}\n {% if relation is not none %}\n {{ adapter.drop_relation(relation) }}\n {% endif %}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.load_relation": {
"unique_id": "macro.dbt.load_relation",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/helpers.sql",
"original_file_path": "macros/materializations/helpers.sql",
"name": "load_relation",
"macro_sql": "{% macro load_relation(relation) %}\n {% do return(adapter.get_relation(\n database=relation.database,\n schema=relation.schema,\n identifier=relation.identifier\n )) -%}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.should_full_refresh": {
"unique_id": "macro.dbt.should_full_refresh",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/helpers.sql",
"original_file_path": "macros/materializations/helpers.sql",
"name": "should_full_refresh",
"macro_sql": "{% macro should_full_refresh() %}\n {% set config_full_refresh = config.get('full_refresh') %}\n {% if config_full_refresh is none %}\n {% set config_full_refresh = flags.FULL_REFRESH %}\n {% endif %}\n {% do return(config_full_refresh) %}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.snapshot_merge_sql": {
"unique_id": "macro.dbt.snapshot_merge_sql",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/snapshot/snapshot_merge.sql",
"original_file_path": "macros/materializations/snapshot/snapshot_merge.sql",
"name": "snapshot_merge_sql",
"macro_sql": "{% macro snapshot_merge_sql(target, source, insert_cols) -%}\n {{ adapter.dispatch('snapshot_merge_sql')(target, source, insert_cols) }}\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.default__snapshot_merge_sql": {
"unique_id": "macro.dbt.default__snapshot_merge_sql",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/snapshot/snapshot_merge.sql",
"original_file_path": "macros/materializations/snapshot/snapshot_merge.sql",
"name": "default__snapshot_merge_sql",
"macro_sql": "{% macro default__snapshot_merge_sql(target, source, insert_cols) -%}\n {%- set insert_cols_csv = insert_cols | join(', ') -%}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on DBT_INTERNAL_SOURCE.dbt_scd_id = DBT_INTERNAL_DEST.dbt_scd_id\n\n when matched\n and DBT_INTERNAL_DEST.dbt_valid_to is null\n and DBT_INTERNAL_SOURCE.dbt_change_type in ('update', 'delete')\n then update\n set dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to\n\n when not matched\n and DBT_INTERNAL_SOURCE.dbt_change_type = 'insert'\n then insert ({{ insert_cols_csv }})\n values ({{ insert_cols_csv }})\n ;\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.strategy_dispatch": {
"unique_id": "macro.dbt.strategy_dispatch",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/snapshot/strategies.sql",
"original_file_path": "macros/materializations/snapshot/strategies.sql",
"name": "strategy_dispatch",
"macro_sql": "{% macro strategy_dispatch(name) -%}\n{% set original_name = name %}\n {% if '.' in name %}\n {% set package_name, name = name.split(\".\", 1) %}\n {% else %}\n {% set package_name = none %}\n {% endif %}\n\n {% if package_name is none %}\n {% set package_context = context %}\n {% elif package_name in context %}\n {% set package_context = context[package_name] %}\n {% else %}\n {% set error_msg %}\n Could not find package '{{package_name}}', called with '{{original_name}}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n\n {%- set search_name = 'snapshot_' ~ name ~ '_strategy' -%}\n\n {% if search_name not in package_context %}\n {% set error_msg %}\n The specified strategy macro '{{name}}' was not found in package '{{ package_name }}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n {{ return(package_context[search_name]) }}\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.snapshot_hash_arguments": {
"unique_id": "macro.dbt.snapshot_hash_arguments",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/snapshot/strategies.sql",
"original_file_path": "macros/materializations/snapshot/strategies.sql",
"name": "snapshot_hash_arguments",
"macro_sql": "{% macro snapshot_hash_arguments(args) -%}\n {{ adapter.dispatch('snapshot_hash_arguments')(args) }}\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.default__snapshot_hash_arguments": {
"unique_id": "macro.dbt.default__snapshot_hash_arguments",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/snapshot/strategies.sql",
"original_file_path": "macros/materializations/snapshot/strategies.sql",
"name": "default__snapshot_hash_arguments",
"macro_sql": "{% macro default__snapshot_hash_arguments(args) -%}\n md5({%- for arg in args -%}\n coalesce(cast({{ arg }} as varchar ), '')\n {% if not loop.last %} || '|' || {% endif %}\n {%- endfor -%})\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.snapshot_get_time": {
"unique_id": "macro.dbt.snapshot_get_time",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/snapshot/strategies.sql",
"original_file_path": "macros/materializations/snapshot/strategies.sql",
"name": "snapshot_get_time",
"macro_sql": "{% macro snapshot_get_time() -%}\n {{ adapter.dispatch('snapshot_get_time')() }}\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.default__snapshot_get_time": {
"unique_id": "macro.dbt.default__snapshot_get_time",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/snapshot/strategies.sql",
"original_file_path": "macros/materializations/snapshot/strategies.sql",
"name": "default__snapshot_get_time",
"macro_sql": "{% macro default__snapshot_get_time() -%}\n {{ current_timestamp() }}\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.snapshot_timestamp_strategy": {
"unique_id": "macro.dbt.snapshot_timestamp_strategy",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/snapshot/strategies.sql",
"original_file_path": "macros/materializations/snapshot/strategies.sql",
"name": "snapshot_timestamp_strategy",
"macro_sql": "{% macro snapshot_timestamp_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set primary_key = config['unique_key'] %}\n {% set updated_at = config['updated_at'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n\n {#/*\n The snapshot relation might not have an {{ updated_at }} value if the\n snapshot strategy is changed from `check` to `timestamp`. We\n should use a dbt-created column for the comparison in the snapshot\n table instead of assuming that the user-supplied {{ updated_at }}\n will be present in the historical data.\n\n See https://github.com/fishtown-analytics/dbt/issues/2350\n */ #}\n {% set row_changed_expr -%}\n ({{ snapshotted_rel }}.dbt_valid_from < {{ current_rel }}.{{ updated_at }})\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.snapshot_string_as_time": {
"unique_id": "macro.dbt.snapshot_string_as_time",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/snapshot/strategies.sql",
"original_file_path": "macros/materializations/snapshot/strategies.sql",
"name": "snapshot_string_as_time",
"macro_sql": "{% macro snapshot_string_as_time(timestamp) -%}\n {{ adapter.dispatch('snapshot_string_as_time')(timestamp) }}\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.default__snapshot_string_as_time": {
"unique_id": "macro.dbt.default__snapshot_string_as_time",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/snapshot/strategies.sql",
"original_file_path": "macros/materializations/snapshot/strategies.sql",
"name": "default__snapshot_string_as_time",
"macro_sql": "{% macro default__snapshot_string_as_time(timestamp) %}\n {% do exceptions.raise_not_implemented(\n 'snapshot_string_as_time macro not implemented for adapter '+adapter.type()\n ) %}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.snapshot_check_all_get_existing_columns": {
"unique_id": "macro.dbt.snapshot_check_all_get_existing_columns",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/snapshot/strategies.sql",
"original_file_path": "macros/materializations/snapshot/strategies.sql",
"name": "snapshot_check_all_get_existing_columns",
"macro_sql": "{% macro snapshot_check_all_get_existing_columns(node, target_exists) -%}\n {%- set query_columns = get_columns_in_query(node['compiled_sql']) -%}\n {%- if not target_exists -%}\n {# no table yet -> return whatever the query does #}\n {{ return([false, query_columns]) }}\n {%- endif -%}\n {# handle any schema changes #}\n {%- set target_table = node.get('alias', node.get('name')) -%}\n {%- set target_relation = adapter.get_relation(database=node.database, schema=node.schema, identifier=target_table) -%}\n {%- set existing_cols = get_columns_in_query('select * from ' ~ target_relation) -%}\n {%- set ns = namespace() -%} {# handle for-loop scoping with a namespace #}\n {%- set ns.column_added = false -%}\n\n {%- set intersection = [] -%}\n {%- for col in query_columns -%}\n {%- if col in existing_cols -%}\n {%- do intersection.append(col) -%}\n {%- else -%}\n {% set ns.column_added = true %}\n {%- endif -%}\n {%- endfor -%}\n {{ return([ns.column_added, intersection]) }}\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.snapshot_check_strategy": {
"unique_id": "macro.dbt.snapshot_check_strategy",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/snapshot/strategies.sql",
"original_file_path": "macros/materializations/snapshot/strategies.sql",
"name": "snapshot_check_strategy",
"macro_sql": "{% macro snapshot_check_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set check_cols_config = config['check_cols'] %}\n {% set primary_key = config['unique_key'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n \n {% set select_current_time -%}\n select {{ snapshot_get_time() }} as snapshot_start\n {%- endset %}\n\n {#-- don't access the column by name, to avoid dealing with casing issues on snowflake #}\n {%- set now = run_query(select_current_time)[0][0] -%}\n {% if now is none or now is undefined -%}\n {%- do exceptions.raise_compiler_error('Could not get a snapshot start time from the database') -%}\n {%- endif %}\n {% set updated_at = snapshot_string_as_time(now) %}\n\n {% set column_added = false %}\n\n {% if check_cols_config == 'all' %}\n {% set column_added, check_cols = snapshot_check_all_get_existing_columns(node, target_exists) %}\n {% elif check_cols_config is iterable and (check_cols_config | length) > 0 %}\n {% set check_cols = check_cols_config %}\n {% else %}\n {% do exceptions.raise_compiler_error(\"Invalid value for 'check_cols': \" ~ check_cols_config) %}\n {% endif %}\n\n {%- set row_changed_expr -%}\n (\n {%- if column_added -%}\n TRUE\n {%- else -%}\n {%- for col in check_cols -%}\n {{ snapshotted_rel }}.{{ col }} != {{ current_rel }}.{{ col }}\n or\n (\n (({{ snapshotted_rel }}.{{ col }} is null) and not ({{ current_rel }}.{{ col }} is null))\n or\n ((not {{ snapshotted_rel }}.{{ col }} is null) and ({{ current_rel }}.{{ col }} is null))\n )\n {%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n {%- endif -%}\n )\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.create_columns": {
"unique_id": "macro.dbt.create_columns",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/snapshot/snapshot.sql",
"original_file_path": "macros/materializations/snapshot/snapshot.sql",
"name": "create_columns",
"macro_sql": "{% macro create_columns(relation, columns) %}\n {{ adapter.dispatch('create_columns')(relation, columns) }}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.default__create_columns": {
"unique_id": "macro.dbt.default__create_columns",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/snapshot/snapshot.sql",
"original_file_path": "macros/materializations/snapshot/snapshot.sql",
"name": "default__create_columns",
"macro_sql": "{% macro default__create_columns(relation, columns) %}\n {% for column in columns %}\n {% call statement() %}\n alter table {{ relation }} add column \"{{ column.name }}\" {{ column.data_type }};\n {% endcall %}\n {% endfor %}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.post_snapshot": {
"unique_id": "macro.dbt.post_snapshot",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/snapshot/snapshot.sql",
"original_file_path": "macros/materializations/snapshot/snapshot.sql",
"name": "post_snapshot",
"macro_sql": "{% macro post_snapshot(staging_relation) %}\n {{ adapter.dispatch('post_snapshot')(staging_relation) }}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.default__post_snapshot": {
"unique_id": "macro.dbt.default__post_snapshot",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/snapshot/snapshot.sql",
"original_file_path": "macros/materializations/snapshot/snapshot.sql",
"name": "default__post_snapshot",
"macro_sql": "{% macro default__post_snapshot(staging_relation) %}\n {# no-op #}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.snapshot_staging_table": {
"unique_id": "macro.dbt.snapshot_staging_table",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/snapshot/snapshot.sql",
"original_file_path": "macros/materializations/snapshot/snapshot.sql",
"name": "snapshot_staging_table",
"macro_sql": "{% macro snapshot_staging_table(strategy, source_sql, target_relation) -%}\n\n with snapshot_query as (\n\n {{ source_sql }}\n\n ),\n\n snapshotted_data as (\n\n select *,\n {{ strategy.unique_key }} as dbt_unique_key\n\n from {{ target_relation }}\n where dbt_valid_to is null\n\n ),\n\n insertions_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to,\n {{ strategy.scd_id }} as dbt_scd_id\n\n from snapshot_query\n ),\n\n updates_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n {{ strategy.updated_at }} as dbt_valid_to\n\n from snapshot_query\n ),\n\n {%- if strategy.invalidate_hard_deletes %}\n\n deletes_source_data as (\n\n select \n *,\n {{ strategy.unique_key }} as dbt_unique_key\n from snapshot_query\n ),\n {% endif %}\n\n insertions as (\n\n select\n 'insert' as dbt_change_type,\n source_data.*\n\n from insertions_source_data as source_data\n left outer join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where snapshotted_data.dbt_unique_key is null\n or (\n snapshotted_data.dbt_unique_key is not null\n and (\n {{ strategy.row_changed }}\n )\n )\n\n ),\n\n updates as (\n\n select\n 'update' as dbt_change_type,\n source_data.*,\n snapshotted_data.dbt_scd_id\n\n from updates_source_data as source_data\n join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where (\n {{ strategy.row_changed }}\n )\n )\n\n {%- if strategy.invalidate_hard_deletes -%}\n ,\n\n deletes as (\n \n select\n 'delete' as dbt_change_type,\n source_data.*,\n {{ snapshot_get_time() }} as dbt_valid_from,\n {{ snapshot_get_time() }} as dbt_updated_at,\n {{ snapshot_get_time() }} as dbt_valid_to,\n snapshotted_data.dbt_scd_id\n \n from snapshotted_data\n left join deletes_source_data as source_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where source_data.dbt_unique_key is null\n )\n {%- endif %}\n\n select * from insertions\n union all\n select * from updates\n {%- if strategy.invalidate_hard_deletes %}\n union all\n select * from deletes\n {%- endif %}\n\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.build_snapshot_table": {
"unique_id": "macro.dbt.build_snapshot_table",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/snapshot/snapshot.sql",
"original_file_path": "macros/materializations/snapshot/snapshot.sql",
"name": "build_snapshot_table",
"macro_sql": "{% macro build_snapshot_table(strategy, sql) %}\n\n select *,\n {{ strategy.scd_id }} as dbt_scd_id,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to\n from (\n {{ sql }}\n ) sbq\n\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.get_or_create_relation": {
"unique_id": "macro.dbt.get_or_create_relation",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/snapshot/snapshot.sql",
"original_file_path": "macros/materializations/snapshot/snapshot.sql",
"name": "get_or_create_relation",
"macro_sql": "{% macro get_or_create_relation(database, schema, identifier, type) %}\n {%- set target_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n\n {% if target_relation %}\n {% do return([true, target_relation]) %}\n {% endif %}\n\n {%- set new_relation = api.Relation.create(\n database=database,\n schema=schema,\n identifier=identifier,\n type=type\n ) -%}\n {% do return([false, new_relation]) %}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.build_snapshot_staging_table": {
"unique_id": "macro.dbt.build_snapshot_staging_table",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/snapshot/snapshot.sql",
"original_file_path": "macros/materializations/snapshot/snapshot.sql",
"name": "build_snapshot_staging_table",
"macro_sql": "{% macro build_snapshot_staging_table(strategy, sql, target_relation) %}\n {% set tmp_relation = make_temp_relation(target_relation) %}\n\n {% set select = snapshot_staging_table(strategy, sql, target_relation) %}\n\n {% call statement('build_snapshot_staging_relation') %}\n {{ create_table_as(True, tmp_relation, select) }}\n {% endcall %}\n\n {% do return(tmp_relation) %}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.materialization_snapshot_default": {
"unique_id": "macro.dbt.materialization_snapshot_default",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/snapshot/snapshot.sql",
"original_file_path": "macros/materializations/snapshot/snapshot.sql",
"name": "materialization_snapshot_default",
"macro_sql": "{% materialization snapshot, default %}\n {%- set config = model['config'] -%}\n\n {%- set target_table = model.get('alias', model.get('name')) -%}\n\n {%- set strategy_name = config.get('strategy') -%}\n {%- set unique_key = config.get('unique_key') %}\n\n {% if not adapter.check_schema_exists(model.database, model.schema) %}\n {% do create_schema(model.database, model.schema) %}\n {% endif %}\n\n {% set target_relation_exists, target_relation = get_or_create_relation(\n database=model.database,\n schema=model.schema,\n identifier=target_table,\n type='table') -%}\n\n {%- if not target_relation.is_table -%}\n {% do exceptions.relation_wrong_type(target_relation, 'table') %}\n {%- endif -%}\n\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set strategy_macro = strategy_dispatch(strategy_name) %}\n {% set strategy = strategy_macro(model, \"snapshotted_data\", \"source_data\", config, target_relation_exists) %}\n\n {% if not target_relation_exists %}\n\n {% set build_sql = build_snapshot_table(strategy, model['compiled_sql']) %}\n {% set final_sql = create_table_as(False, target_relation, build_sql) %}\n\n {% else %}\n\n {{ adapter.valid_snapshot_target(target_relation) }}\n\n {% set staging_table = build_snapshot_staging_table(strategy, sql, target_relation) %}\n\n -- this may no-op if the database does not require column expansion\n {% do adapter.expand_target_column_types(from_relation=staging_table,\n to_relation=target_relation) %}\n\n {% set missing_columns = adapter.get_missing_columns(staging_table, target_relation)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% do create_columns(target_relation, missing_columns) %}\n\n {% set source_columns = adapter.get_columns_in_relation(staging_table)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% set quoted_source_columns = [] %}\n {% for column in source_columns %}\n {% do quoted_source_columns.append(adapter.quote(column.name)) %}\n {% endfor %}\n\n {% set final_sql = snapshot_merge_sql(\n target = target_relation,\n source = staging_table,\n insert_cols = quoted_source_columns\n )\n %}\n\n {% endif %}\n\n {% call statement('main') %}\n {{ final_sql }}\n {% endcall %}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {% if staging_table is defined %}\n {% do post_snapshot(staging_table) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.create_csv_table": {
"unique_id": "macro.dbt.create_csv_table",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/seed/seed.sql",
"original_file_path": "macros/materializations/seed/seed.sql",
"name": "create_csv_table",
"macro_sql": "{% macro create_csv_table(model, agate_table) -%}\n {{ adapter.dispatch('create_csv_table')(model, agate_table) }}\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.reset_csv_table": {
"unique_id": "macro.dbt.reset_csv_table",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/seed/seed.sql",
"original_file_path": "macros/materializations/seed/seed.sql",
"name": "reset_csv_table",
"macro_sql": "{% macro reset_csv_table(model, full_refresh, old_relation, agate_table) -%}\n {{ adapter.dispatch('reset_csv_table')(model, full_refresh, old_relation, agate_table) }}\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.load_csv_rows": {
"unique_id": "macro.dbt.load_csv_rows",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/seed/seed.sql",
"original_file_path": "macros/materializations/seed/seed.sql",
"name": "load_csv_rows",
"macro_sql": "{% macro load_csv_rows(model, agate_table) -%}\n {{ adapter.dispatch('load_csv_rows')(model, agate_table) }}\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.default__create_csv_table": {
"unique_id": "macro.dbt.default__create_csv_table",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/seed/seed.sql",
"original_file_path": "macros/materializations/seed/seed.sql",
"name": "default__create_csv_table",
"macro_sql": "{% macro default__create_csv_table(model, agate_table) %}\n {%- set column_override = model['config'].get('column_types', {}) -%}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n\n {% set sql %}\n create table {{ this.render() }} (\n {%- for col_name in agate_table.column_names -%}\n {%- set inferred_type = adapter.convert_type(agate_table, loop.index0) -%}\n {%- set type = column_override.get(col_name, inferred_type) -%}\n {%- set column_name = (col_name | string) -%}\n {{ adapter.quote_seed_column(column_name, quote_seed_column) }} {{ type }} {%- if not loop.last -%}, {%- endif -%}\n {%- endfor -%}\n )\n {% endset %}\n\n {% call statement('_') -%}\n {{ sql }}\n {%- endcall %}\n\n {{ return(sql) }}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.default__reset_csv_table": {
"unique_id": "macro.dbt.default__reset_csv_table",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/seed/seed.sql",
"original_file_path": "macros/materializations/seed/seed.sql",
"name": "default__reset_csv_table",
"macro_sql": "{% macro default__reset_csv_table(model, full_refresh, old_relation, agate_table) %}\n {% set sql = \"\" %}\n {% if full_refresh %}\n {{ adapter.drop_relation(old_relation) }}\n {% set sql = create_csv_table(model, agate_table) %}\n {% else %}\n {{ adapter.truncate_relation(old_relation) }}\n {% set sql = \"truncate table \" ~ old_relation %}\n {% endif %}\n\n {{ return(sql) }}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.get_seed_column_quoted_csv": {
"unique_id": "macro.dbt.get_seed_column_quoted_csv",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/seed/seed.sql",
"original_file_path": "macros/materializations/seed/seed.sql",
"name": "get_seed_column_quoted_csv",
"macro_sql": "{% macro get_seed_column_quoted_csv(model, column_names) %}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote_seed_column(col, quote_seed_column)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.basic_load_csv_rows": {
"unique_id": "macro.dbt.basic_load_csv_rows",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/seed/seed.sql",
"original_file_path": "macros/materializations/seed/seed.sql",
"name": "basic_load_csv_rows",
"macro_sql": "{% macro basic_load_csv_rows(model, batch_size, agate_table) %}\n {% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %}\n {% set bindings = [] %}\n\n {% set statements = [] %}\n\n {% for chunk in agate_table.rows | batch(batch_size) %}\n {% set bindings = [] %}\n\n {% for row in chunk %}\n {% do bindings.extend(row) %}\n {% endfor %}\n\n {% set sql %}\n insert into {{ this.render() }} ({{ cols_sql }}) values\n {% for row in chunk -%}\n ({%- for column in agate_table.column_names -%}\n %s\n {%- if not loop.last%},{%- endif %}\n {%- endfor -%})\n {%- if not loop.last%},{%- endif %}\n {%- endfor %}\n {% endset %}\n\n {% do adapter.add_query(sql, bindings=bindings, abridge_sql_log=True) %}\n\n {% if loop.index0 == 0 %}\n {% do statements.append(sql) %}\n {% endif %}\n {% endfor %}\n\n {# Return SQL so we can render it out into the compiled files #}\n {{ return(statements[0]) }}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.default__load_csv_rows": {
"unique_id": "macro.dbt.default__load_csv_rows",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/seed/seed.sql",
"original_file_path": "macros/materializations/seed/seed.sql",
"name": "default__load_csv_rows",
"macro_sql": "{% macro default__load_csv_rows(model, agate_table) %}\n {{ return(basic_load_csv_rows(model, 10000, agate_table) )}}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.materialization_seed_default": {
"unique_id": "macro.dbt.materialization_seed_default",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/seed/seed.sql",
"original_file_path": "macros/materializations/seed/seed.sql",
"name": "materialization_seed_default",
"macro_sql": "{% materialization seed, default %}\n\n {%- set identifier = model['alias'] -%}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set agate_table = load_agate_table() -%}\n {%- do store_result('agate_table', response='OK', agate_table=agate_table) -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% set create_table_sql = \"\" %}\n {% if exists_as_view %}\n {{ exceptions.raise_compiler_error(\"Cannot seed to '{}', it is a view\".format(old_relation)) }}\n {% elif exists_as_table %}\n {% set create_table_sql = reset_csv_table(model, full_refresh_mode, old_relation, agate_table) %}\n {% else %}\n {% set create_table_sql = create_csv_table(model, agate_table) %}\n {% endif %}\n\n {% set code = 'CREATE' if full_refresh_mode else 'INSERT' %}\n {% set rows_affected = (agate_table.rows | length) %}\n {% set sql = load_csv_rows(model, agate_table) %}\n\n {% call noop_statement('main', code ~ ' ' ~ rows_affected, code, rows_affected) %}\n {{ create_table_sql }};\n -- dbt seed --\n {{ sql }}\n {% endcall %}\n\n {% set target_relation = this.incorporate(type='table') %}\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.incremental_upsert": {
"unique_id": "macro.dbt.incremental_upsert",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/incremental/helpers.sql",
"original_file_path": "macros/materializations/incremental/helpers.sql",
"name": "incremental_upsert",
"macro_sql": "{% macro incremental_upsert(tmp_relation, target_relation, unique_key=none, statement_name=\"main\") %}\n {%- set dest_columns = adapter.get_columns_in_relation(target_relation) -%}\n {%- set dest_cols_csv = dest_columns | map(attribute='quoted') | join(', ') -%}\n\n {%- if unique_key is not none -%}\n delete\n from {{ target_relation }}\n where ({{ unique_key }}) in (\n select ({{ unique_key }})\n from {{ tmp_relation }}\n );\n {%- endif %}\n\n insert into {{ target_relation }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ tmp_relation }}\n );\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.materialization_incremental_default": {
"unique_id": "macro.dbt.materialization_incremental_default",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/incremental/incremental.sql",
"original_file_path": "macros/materializations/incremental/incremental.sql",
"name": "materialization_incremental_default",
"macro_sql": "{% materialization incremental, default -%}\n\n {% set unique_key = config.get('unique_key') %}\n\n {% set target_relation = this.incorporate(type='table') %}\n {% set existing_relation = load_relation(this) %}\n {% set tmp_relation = make_temp_relation(this) %}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set to_drop = [] %}\n {% if existing_relation is none %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n {% elif existing_relation.is_view or should_full_refresh() %}\n {#-- Make sure the backup doesn't exist so we don't encounter issues with the rename below #}\n {% set backup_identifier = existing_relation.identifier ~ \"__dbt_backup\" %}\n {% set backup_relation = existing_relation.incorporate(path={\"identifier\": backup_identifier}) %}\n {% do adapter.drop_relation(backup_relation) %}\n\n {% do adapter.rename_relation(target_relation, backup_relation) %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n {% do to_drop.append(backup_relation) %}\n {% else %}\n {% set tmp_relation = make_temp_relation(target_relation) %}\n {% do run_query(create_table_as(True, tmp_relation, sql)) %}\n {% do adapter.expand_target_column_types(\n from_relation=tmp_relation,\n to_relation=target_relation) %}\n {% set build_sql = incremental_upsert(tmp_relation, target_relation, unique_key=unique_key) %}\n {% endif %}\n\n {% call statement(\"main\") %}\n {{ build_sql }}\n {% endcall %}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {% do adapter.commit() %}\n\n {% for rel in to_drop %}\n {% do adapter.drop_relation(rel) %}\n {% endfor %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.get_merge_sql": {
"unique_id": "macro.dbt.get_merge_sql",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/common/merge.sql",
"original_file_path": "macros/materializations/common/merge.sql",
"name": "get_merge_sql",
"macro_sql": "{% macro get_merge_sql(target, source, unique_key, dest_columns, predicates=none) -%}\n {{ adapter.dispatch('get_merge_sql')(target, source, unique_key, dest_columns, predicates) }}\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.get_delete_insert_merge_sql": {
"unique_id": "macro.dbt.get_delete_insert_merge_sql",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/common/merge.sql",
"original_file_path": "macros/materializations/common/merge.sql",
"name": "get_delete_insert_merge_sql",
"macro_sql": "{% macro get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n {{ adapter.dispatch('get_delete_insert_merge_sql')(target, source, unique_key, dest_columns) }}\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.get_insert_overwrite_merge_sql": {
"unique_id": "macro.dbt.get_insert_overwrite_merge_sql",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/common/merge.sql",
"original_file_path": "macros/materializations/common/merge.sql",
"name": "get_insert_overwrite_merge_sql",
"macro_sql": "{% macro get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header=false) -%}\n {{ adapter.dispatch('get_insert_overwrite_merge_sql')(target, source, dest_columns, predicates, include_sql_header) }}\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.default__get_merge_sql": {
"unique_id": "macro.dbt.default__get_merge_sql",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/common/merge.sql",
"original_file_path": "macros/materializations/common/merge.sql",
"name": "default__get_merge_sql",
"macro_sql": "{% macro default__get_merge_sql(target, source, unique_key, dest_columns, predicates) -%}\n {%- set predicates = [] if predicates is none else [] + predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {% if unique_key %}\n {% set unique_key_match %}\n DBT_INTERNAL_SOURCE.{{ unique_key }} = DBT_INTERNAL_DEST.{{ unique_key }}\n {% endset %}\n {% do predicates.append(unique_key_match) %}\n {% else %}\n {% do predicates.append('FALSE') %}\n {% endif %}\n\n {{ sql_header if sql_header is not none }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on {{ predicates | join(' and ') }}\n\n {% if unique_key %}\n when matched then update set\n {% for column in dest_columns -%}\n {{ adapter.quote(column.name) }} = DBT_INTERNAL_SOURCE.{{ adapter.quote(column.name) }}\n {%- if not loop.last %}, {%- endif %}\n {%- endfor %}\n {% endif %}\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.get_quoted_csv": {
"unique_id": "macro.dbt.get_quoted_csv",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/common/merge.sql",
"original_file_path": "macros/materializations/common/merge.sql",
"name": "get_quoted_csv",
"macro_sql": "{% macro get_quoted_csv(column_names) %}\n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote(col)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.common_get_delete_insert_merge_sql": {
"unique_id": "macro.dbt.common_get_delete_insert_merge_sql",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/common/merge.sql",
"original_file_path": "macros/materializations/common/merge.sql",
"name": "common_get_delete_insert_merge_sql",
"macro_sql": "{% macro common_get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n {% if unique_key is not none %}\n delete from {{ target }}\n where ({{ unique_key }}) in (\n select ({{ unique_key }})\n from {{ source }}\n );\n {% endif %}\n\n insert into {{ target }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ source }}\n );\n\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.default__get_delete_insert_merge_sql": {
"unique_id": "macro.dbt.default__get_delete_insert_merge_sql",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/common/merge.sql",
"original_file_path": "macros/materializations/common/merge.sql",
"name": "default__get_delete_insert_merge_sql",
"macro_sql": "{% macro default__get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n {{ common_get_delete_insert_merge_sql(target, source, unique_key, dest_columns) }}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.default__get_insert_overwrite_merge_sql": {
"unique_id": "macro.dbt.default__get_insert_overwrite_merge_sql",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/common/merge.sql",
"original_file_path": "macros/materializations/common/merge.sql",
"name": "default__get_insert_overwrite_merge_sql",
"macro_sql": "{% macro default__get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header) -%}\n {%- set predicates = [] if predicates is none else [] + predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none and include_sql_header }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on FALSE\n\n when not matched by source\n {% if predicates %} and {{ predicates | join(' and ') }} {% endif %}\n then delete\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.materialization_table_default": {
"unique_id": "macro.dbt.materialization_table_default",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/table/table.sql",
"original_file_path": "macros/materializations/table/table.sql",
"name": "materialization_table_default",
"macro_sql": "{% materialization table, default %}\n {%- set identifier = model['alias'] -%}\n {%- set tmp_identifier = model['name'] + '__dbt_tmp' -%}\n {%- set backup_identifier = model['name'] + '__dbt_backup' -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier,\n schema=schema,\n database=database,\n type='table') -%}\n {%- set intermediate_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema,\n database=database,\n type='table') -%}\n\n /*\n See ../view/view.sql for more information about this relation.\n */\n {%- set backup_relation_type = 'table' if old_relation is none else old_relation.type -%}\n {%- set backup_relation = api.Relation.create(identifier=backup_identifier,\n schema=schema,\n database=database,\n type=backup_relation_type) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n\n -- drop the temp relations if they exists for some reason\n {{ adapter.drop_relation(intermediate_relation) }}\n {{ adapter.drop_relation(backup_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ create_table_as(False, intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n {% if old_relation is not none %}\n {{ adapter.rename_relation(target_relation, backup_relation) }}\n {% endif %}\n\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {% do persist_docs(target_relation, model) %}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n -- finally, drop the existing/backup relation after the commit\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n{% endmaterialization %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.materialization_view_default": {
"unique_id": "macro.dbt.materialization_view_default",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/view/view.sql",
"original_file_path": "macros/materializations/view/view.sql",
"name": "materialization_view_default",
"macro_sql": "{%- materialization view, default -%}\n\n {%- set identifier = model['alias'] -%}\n {%- set tmp_identifier = model['name'] + '__dbt_tmp' -%}\n {%- set backup_identifier = model['name'] + '__dbt_backup' -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier, schema=schema, database=database,\n type='view') -%}\n {%- set intermediate_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema, database=database, type='view') -%}\n\n /*\n This relation (probably) doesn't exist yet. If it does exist, it's a leftover from\n a previous run, and we're going to try to drop it immediately. At the end of this\n materialization, we're going to rename the \"old_relation\" to this identifier,\n and then we're going to drop it. In order to make sure we run the correct one of:\n - drop view ...\n - drop table ...\n\n We need to set the type of this relation to be the type of the old_relation, if it exists,\n or else \"view\" as a sane default if it does not. Note that if the old_relation does not\n exist, then there is nothing to move out of the way and subsequentally drop. In that case,\n this relation will be effectively unused.\n */\n {%- set backup_relation_type = 'view' if old_relation is none else old_relation.type -%}\n {%- set backup_relation = api.Relation.create(identifier=backup_identifier,\n schema=schema, database=database,\n type=backup_relation_type) -%}\n\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- drop the temp relations if they exists for some reason\n {{ adapter.drop_relation(intermediate_relation) }}\n {{ adapter.drop_relation(backup_relation) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ create_view_as(intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n -- move the existing view out of the way\n {% if old_relation is not none %}\n {{ adapter.rename_relation(target_relation, backup_relation) }}\n {% endif %}\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization -%}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.handle_existing_table": {
"unique_id": "macro.dbt.handle_existing_table",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/view/create_or_replace_view.sql",
"original_file_path": "macros/materializations/view/create_or_replace_view.sql",
"name": "handle_existing_table",
"macro_sql": "{% macro handle_existing_table(full_refresh, old_relation) %}\n {{ adapter.dispatch(\"handle_existing_table\", packages=['dbt'])(full_refresh, old_relation) }}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.default__handle_existing_table": {
"unique_id": "macro.dbt.default__handle_existing_table",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/view/create_or_replace_view.sql",
"original_file_path": "macros/materializations/view/create_or_replace_view.sql",
"name": "default__handle_existing_table",
"macro_sql": "{% macro default__handle_existing_table(full_refresh, old_relation) %}\n {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.create_or_replace_view": {
"unique_id": "macro.dbt.create_or_replace_view",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/materializations/view/create_or_replace_view.sql",
"original_file_path": "macros/materializations/view/create_or_replace_view.sql",
"name": "create_or_replace_view",
"macro_sql": "{% macro create_or_replace_view(run_outside_transaction_hooks=True) %}\n {%- set identifier = model['alias'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database,\n type='view') -%}\n\n {% if run_outside_transaction_hooks %}\n -- no transactions on BigQuery\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n {% endif %}\n\n -- `BEGIN` happens here on Snowflake\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- If there's a table with the same name and we weren't told to full refresh,\n -- that's an error. If we were told to full refresh, drop it. This behavior differs\n -- for Snowflake and BigQuery, so multiple dispatch is used.\n {%- if old_relation is not none and old_relation.is_table -%}\n {{ handle_existing_table(should_full_refresh(), old_relation) }}\n {%- endif -%}\n\n -- build model\n {% call statement('main') -%}\n {{ create_view_as(target_relation, sql) }}\n {%- endcall %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {% if run_outside_transaction_hooks %}\n -- No transactions on BigQuery\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n {% endif %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.generate_alias_name": {
"unique_id": "macro.dbt.generate_alias_name",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/etc/get_custom_alias.sql",
"original_file_path": "macros/etc/get_custom_alias.sql",
"name": "generate_alias_name",
"macro_sql": "{% macro generate_alias_name(custom_alias_name=none, node=none) -%}\n\n {%- if custom_alias_name is none -%}\n\n {{ node.name }}\n\n {%- else -%}\n\n {{ custom_alias_name | trim }}\n\n {%- endif -%}\n\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.run_query": {
"unique_id": "macro.dbt.run_query",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/etc/query.sql",
"original_file_path": "macros/etc/query.sql",
"name": "run_query",
"macro_sql": "{% macro run_query(sql) %}\n {% call statement(\"run_query_statement\", fetch_result=true, auto_begin=false) %}\n {{ sql }}\n {% endcall %}\n\n {% do return(load_result(\"run_query_statement\").table) %}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.is_incremental": {
"unique_id": "macro.dbt.is_incremental",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/etc/is_incremental.sql",
"original_file_path": "macros/etc/is_incremental.sql",
"name": "is_incremental",
"macro_sql": "{% macro is_incremental() %}\n {#-- do not run introspective queries in parsing #}\n {% if not execute %}\n {{ return(False) }}\n {% else %}\n {% set relation = adapter.get_relation(this.database, this.schema, this.table) %}\n {{ return(relation is not none\n and relation.type == 'table'\n and model.config.materialized == 'incremental'\n and not should_full_refresh()) }}\n {% endif %}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.convert_datetime": {
"unique_id": "macro.dbt.convert_datetime",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/etc/datetime.sql",
"original_file_path": "macros/etc/datetime.sql",
"name": "convert_datetime",
"macro_sql": "{% macro convert_datetime(date_str, date_fmt) %}\n\n {% set error_msg -%}\n The provided partition date '{{ date_str }}' does not match the expected format '{{ date_fmt }}'\n {%- endset %}\n\n {% set res = try_or_compiler_error(error_msg, modules.datetime.datetime.strptime, date_str.strip(), date_fmt) %}\n {{ return(res) }}\n\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.dates_in_range": {
"unique_id": "macro.dbt.dates_in_range",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/etc/datetime.sql",
"original_file_path": "macros/etc/datetime.sql",
"name": "dates_in_range",
"macro_sql": "{% macro dates_in_range(start_date_str, end_date_str=none, in_fmt=\"%Y%m%d\", out_fmt=\"%Y%m%d\") %}\n {% set end_date_str = start_date_str if end_date_str is none else end_date_str %}\n\n {% set start_date = convert_datetime(start_date_str, in_fmt) %}\n {% set end_date = convert_datetime(end_date_str, in_fmt) %}\n\n {% set day_count = (end_date - start_date).days %}\n {% if day_count < 0 %}\n {% set msg -%}\n Partiton start date is after the end date ({{ start_date }}, {{ end_date }})\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg, model) }}\n {% endif %}\n\n {% set date_list = [] %}\n {% for i in range(0, day_count + 1) %}\n {% set the_date = (modules.datetime.timedelta(days=i) + start_date) %}\n {% if not out_fmt %}\n {% set _ = date_list.append(the_date) %}\n {% else %}\n {% set _ = date_list.append(the_date.strftime(out_fmt)) %}\n {% endif %}\n {% endfor %}\n\n {{ return(date_list) }}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.partition_range": {
"unique_id": "macro.dbt.partition_range",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/etc/datetime.sql",
"original_file_path": "macros/etc/datetime.sql",
"name": "partition_range",
"macro_sql": "{% macro partition_range(raw_partition_date, date_fmt='%Y%m%d') %}\n {% set partition_range = (raw_partition_date | string).split(\",\") %}\n\n {% if (partition_range | length) == 1 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = none %}\n {% elif (partition_range | length) == 2 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = partition_range[1] %}\n {% else %}\n {{ exceptions.raise_compiler_error(\"Invalid partition time. Expected format: {Start Date}[,{End Date}]. Got: \" ~ raw_partition_date) }}\n {% endif %}\n\n {{ return(dates_in_range(start_date, end_date, in_fmt=date_fmt)) }}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.py_current_timestring": {
"unique_id": "macro.dbt.py_current_timestring",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/etc/datetime.sql",
"original_file_path": "macros/etc/datetime.sql",
"name": "py_current_timestring",
"macro_sql": "{% macro py_current_timestring() %}\n {% set dt = modules.datetime.datetime.now() %}\n {% do return(dt.strftime(\"%Y%m%d%H%M%S%f\")) %}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.generate_schema_name": {
"unique_id": "macro.dbt.generate_schema_name",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/etc/get_custom_schema.sql",
"original_file_path": "macros/etc/get_custom_schema.sql",
"name": "generate_schema_name",
"macro_sql": "{% macro generate_schema_name(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if custom_schema_name is none -%}\n\n {{ default_schema }}\n\n {%- else -%}\n\n {{ default_schema }}_{{ custom_schema_name | trim }}\n\n {%- endif -%}\n\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.generate_schema_name_for_env": {
"unique_id": "macro.dbt.generate_schema_name_for_env",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/etc/get_custom_schema.sql",
"original_file_path": "macros/etc/get_custom_schema.sql",
"name": "generate_schema_name_for_env",
"macro_sql": "{% macro generate_schema_name_for_env(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if target.name == 'prod' and custom_schema_name is not none -%}\n\n {{ custom_schema_name | trim }}\n\n {%- else -%}\n\n {{ default_schema }}\n\n {%- endif -%}\n\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.generate_database_name": {
"unique_id": "macro.dbt.generate_database_name",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/etc/get_custom_database.sql",
"original_file_path": "macros/etc/get_custom_database.sql",
"name": "generate_database_name",
"macro_sql": "{% macro generate_database_name(custom_database_name=none, node=none) -%}\n {% do return(adapter.dispatch('generate_database_name')(custom_database_name, node)) %}\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": ["macro.dbt.default__generate_database_name"]
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.default__generate_database_name": {
"unique_id": "macro.dbt.default__generate_database_name",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/etc/get_custom_database.sql",
"original_file_path": "macros/etc/get_custom_database.sql",
"name": "default__generate_database_name",
"macro_sql": "{% macro default__generate_database_name(custom_database_name=none, node=none) -%}\n {%- set default_database = target.database -%}\n {%- if custom_database_name is none -%}\n\n {{ default_database }}\n\n {%- else -%}\n\n {{ custom_database_name }}\n\n {%- endif -%}\n\n{%- endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.get_columns_in_query": {
"unique_id": "macro.dbt.get_columns_in_query",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/adapters/common.sql",
"original_file_path": "macros/adapters/common.sql",
"name": "get_columns_in_query",
"macro_sql": "{% macro get_columns_in_query(select_sql) -%}\n {{ return(adapter.dispatch('get_columns_in_query')(select_sql)) }}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.default__get_columns_in_query": {
"unique_id": "macro.dbt.default__get_columns_in_query",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/adapters/common.sql",
"original_file_path": "macros/adapters/common.sql",
"name": "default__get_columns_in_query",
"macro_sql": "{% macro default__get_columns_in_query(select_sql) %}\n {% call statement('get_columns_in_query', fetch_result=True, auto_begin=False) -%}\n select * from (\n {{ select_sql }}\n ) as __dbt_sbq\n where false\n limit 0\n {% endcall %}\n\n {{ return(load_result('get_columns_in_query').table.columns | map(attribute='name') | list) }}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.create_schema": {
"unique_id": "macro.dbt.create_schema",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/adapters/common.sql",
"original_file_path": "macros/adapters/common.sql",
"name": "create_schema",
"macro_sql": "{% macro create_schema(relation) -%}\n {{ adapter.dispatch('create_schema')(relation) }}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true
},
"patch_path": null,
"arguments": []
},
"macro.dbt.default__create_schema": {
"unique_id": "macro.dbt.default__create_schema",
"package_name": "dbt",
"root_path": "/Users/grantseward/pyenv/dbt/lib/python3.7/site-packages/dbt/include/global_project",
"path": "macros/adapters/common.sql",
"original_file_path": "macros/adapters/common.sql",
"name": "default__create_schema",
"macro_sql": "{% macro default__create_schema(relation) -%}\n {%- call statement('create_schema') -%}\n create schema if not exists {{ relation.without_identifier() }}\n {% endcall %}\n{% endmacro %}",
"resource_type": "macro",
"tags": [],
"depends_on": {
"macros": []
},
"description": "",
"meta": {},
"docs": {
"show": true