Skip to content

Commit

Permalink
Formatted sources
Browse files Browse the repository at this point in the history
Formatted sources and corrected snapshot_executions
  • Loading branch information
poloaraujo committed Oct 2, 2023
1 parent b825bdf commit 504a683
Show file tree
Hide file tree
Showing 13 changed files with 247 additions and 217 deletions.
51 changes: 26 additions & 25 deletions models/fct_dbt__snapshot_executions.sql
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
with base as (
with
base as (

select *
from {{ ref('stg_dbt__snapshot_executions') }}
select *
from {{ ref('stg_dbt__snapshot_executions') }}

),
)

snapshot_executions as (
, snapshot_executions as (

select
snapshot_execution_id,
command_invocation_id,
node_id,
run_started_at,
was_full_refresh,
thread_id,
status,
compile_started_at,
query_completed_at,
total_node_runtime,
rows_affected,
materialization,
schema,
name,
alias,
message
from base
select
snapshot_execution_id
, command_invocation_id
, node_id
, run_started_at
, was_full_refresh
, thread_id
, status
, compile_started_at
, query_completed_at
, total_node_runtime
, rows_affected
, materialization
, schema
, name
, alias
, message
from base

)
)

select * from snapshot_executions
select * from snapshot_executions
37 changes: 20 additions & 17 deletions models/sources/exposures.sql
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
/* Bigquery won't let us `where` without `from` so we use this workaround */
with dummy_cte as (
select 1 as foo
)
with
dummy_cte as (

select 1 as foo

)

select
cast(null as {{ type_string() }}) as command_invocation_id,
cast(null as {{ type_string() }}) as node_id,
cast(null as {{ type_timestamp() }}) as run_started_at,
cast(null as {{ type_string() }}) as name,
cast(null as {{ type_string() }}) as type,
cast(null as {{ type_json() }}) as owner,
cast(null as {{ type_string() }}) as maturity,
cast(null as {{ type_string() }}) as path,
cast(null as {{ type_string() }}) as description,
cast(null as {{ type_string() }}) as url,
cast(null as {{ type_string() }}) as package_name,
cast(null as {{ type_array() }}) as depends_on_nodes,
cast(null as {{ type_array() }}) as tags,
cast(null as {{ type_json() }}) as all_results
cast(null as {{ type_string() }}) as command_invocation_id
, cast(null as {{ type_string() }}) as node_id
, cast(null as {{ type_timestamp() }}) as run_started_at
, cast(null as {{ type_string() }}) as name
, cast(null as {{ type_string() }}) as type
, cast(null as {{ type_json() }}) as owner
, cast(null as {{ type_string() }}) as maturity
, cast(null as {{ type_string() }}) as path
, cast(null as {{ type_string() }}) as description
, cast(null as {{ type_string() }}) as url
, cast(null as {{ type_string() }}) as package_name
, cast(null as {{ type_array() }}) as depends_on_nodes
, cast(null as {{ type_array() }}) as tags
, cast(null as {{ type_json() }}) as all_results
from dummy_cte
where 1 = 0
47 changes: 25 additions & 22 deletions models/sources/invocations.sql
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
/* Bigquery won't let us `where` without `from` so we use this workaround */
with dummy_cte as (
select 1 as foo
)
with
dummy_cte as (

select 1 as foo

)

select
cast(null as {{ type_string() }}) as command_invocation_id,
cast(null as {{ type_string() }}) as dbt_version,
cast(null as {{ type_string() }}) as project_name,
cast(null as {{ type_timestamp() }}) as run_started_at,
cast(null as {{ type_string() }}) as dbt_command,
cast(null as {{ type_boolean() }}) as full_refresh_flag,
cast(null as {{ type_string() }}) as target_profile_name,
cast(null as {{ type_string() }}) as target_name,
cast(null as {{ type_string() }}) as target_schema,
cast(null as {{ type_int() }}) as target_threads,
cast(null as {{ type_string() }}) as dbt_cloud_project_id,
cast(null as {{ type_string() }}) as dbt_cloud_job_id,
cast(null as {{ type_string() }}) as dbt_cloud_run_id,
cast(null as {{ type_string() }}) as dbt_cloud_run_reason_category,
cast(null as {{ type_string() }}) as dbt_cloud_run_reason,
cast(null as {{ type_json() }}) as env_vars,
cast(null as {{ type_json() }}) as dbt_vars,
cast(null as {{ type_json() }}) as invocation_args,
cast(null as {{ type_json() }}) as dbt_custom_envs
cast(null as {{ type_string() }}) as command_invocation_id
, cast(null as {{ type_string() }}) as dbt_version
, cast(null as {{ type_string() }}) as project_name
, cast(null as {{ type_timestamp() }}) as run_started_at
, cast(null as {{ type_string() }}) as dbt_command
, cast(null as {{ type_boolean() }}) as full_refresh_flag
, cast(null as {{ type_string() }}) as target_profile_name
, cast(null as {{ type_string() }}) as target_name
, cast(null as {{ type_string() }}) as target_schema
, cast(null as {{ type_int() }}) as target_threads
, cast(null as {{ type_string() }}) as dbt_cloud_project_id
, cast(null as {{ type_string() }}) as dbt_cloud_job_id
, cast(null as {{ type_string() }}) as dbt_cloud_run_id
, cast(null as {{ type_string() }}) as dbt_cloud_run_reason_category
, cast(null as {{ type_string() }}) as dbt_cloud_run_reason
, cast(null as {{ type_json() }}) as env_vars
, cast(null as {{ type_json() }}) as dbt_vars
, cast(null as {{ type_json() }}) as invocation_args
, cast(null as {{ type_json() }}) as dbt_custom_envs
from dummy_cte
where 1 = 0
43 changes: 23 additions & 20 deletions models/sources/model_executions.sql
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
/* Bigquery won't let us `where` without `from` so we use this workaround */
with dummy_cte as (
select 1 as foo
)
with
dummy_cte as (

select 1 as foo

)

select
cast(null as {{ type_string() }}) as command_invocation_id,
cast(null as {{ type_string() }}) as node_id,
cast(null as {{ type_timestamp() }}) as run_started_at,
cast(null as {{ type_boolean() }}) as was_full_refresh,
cast(null as {{ type_string() }}) as thread_id,
cast(null as {{ type_string() }}) as status,
cast(null as {{ type_timestamp() }}) as compile_started_at,
cast(null as {{ type_timestamp() }}) as query_completed_at,
cast(null as {{ type_float() }}) as total_node_runtime,
cast(null as {{ type_int() }}) as rows_affected,
cast(null as {{ type_string() }}) as command_invocation_id
, cast(null as {{ type_string() }}) as node_id
, cast(null as {{ type_timestamp() }}) as run_started_at
, cast(null as {{ type_boolean() }}) as was_full_refresh
, cast(null as {{ type_string() }}) as thread_id
, cast(null as {{ type_string() }}) as status
, cast(null as {{ type_timestamp() }}) as compile_started_at
, cast(null as {{ type_timestamp() }}) as query_completed_at
, cast(null as {{ type_float() }}) as total_node_runtime
, cast(null as {{ type_int() }}) as rows_affected
{% if target.type == 'bigquery' %}
cast(null as {{ type_int() }}) as bytes_processed,
, cast(null as {{ type_int() }}) as bytes_processed
{% endif %}
cast(null as {{ type_string() }}) as materialization,
cast(null as {{ type_string() }}) as schema,
cast(null as {{ type_string() }}) as name,
cast(null as {{ type_string() }}) as alias,
cast(null as {{ type_string() }}) as message,
cast(null as {{ type_json() }}) as adapter_response
, cast(null as {{ type_string() }}) as materialization
, cast(null as {{ type_string() }}) as schema
, cast(null as {{ type_string() }}) as name
, cast(null as {{ type_string() }}) as alias
, cast(null as {{ type_string() }}) as message
, cast(null as {{ type_json() }}) as adapter_response
from dummy_cte
where 1 = 0
39 changes: 21 additions & 18 deletions models/sources/models.sql
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
/* Bigquery won't let us `where` without `from` so we use this workaround */
with dummy_cte as (
select 1 as foo
)
with
dummy_cte as (

select 1 as foo

)

select
cast(null as {{ type_string() }}) as command_invocation_id,
cast(null as {{ type_string() }}) as node_id,
cast(null as {{ type_timestamp() }}) as run_started_at,
cast(null as {{ type_string() }}) as database,
cast(null as {{ type_string() }}) as schema,
cast(null as {{ type_string() }}) as name,
cast(null as {{ type_array() }}) as depends_on_nodes,
cast(null as {{ type_string() }}) as package_name,
cast(null as {{ type_string() }}) as path,
cast(null as {{ type_string() }}) as checksum,
cast(null as {{ type_string() }}) as materialization,
cast(null as {{ type_array() }}) as tags,
cast(null as {{ type_json() }}) as meta,
cast(null as {{ type_string() }}) as alias,
cast(null as {{ type_json() }}) as all_results
cast(null as {{ type_string() }}) as command_invocation_id
, cast(null as {{ type_string() }}) as node_id
, cast(null as {{ type_timestamp() }}) as run_started_at
, cast(null as {{ type_string() }}) as database
, cast(null as {{ type_string() }}) as schema
, cast(null as {{ type_string() }}) as name
, cast(null as {{ type_array() }}) as depends_on_nodes
, cast(null as {{ type_string() }}) as package_name
, cast(null as {{ type_string() }}) as path
, cast(null as {{ type_string() }}) as checksum
, cast(null as {{ type_string() }}) as materialization
, cast(null as {{ type_array() }}) as tags
, cast(null as {{ type_json() }}) as meta
, cast(null as {{ type_string() }}) as alias
, cast(null as {{ type_json() }}) as all_results
from dummy_cte
where 1 = 0
41 changes: 22 additions & 19 deletions models/sources/seed_executions.sql
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
/* Bigquery won't let us `where` without `from` so we use this workaround */
with dummy_cte as (
select 1 as foo
)
with
dummy_cte as (

select 1 as foo

)

select
cast(null as {{ type_string() }}) as command_invocation_id,
cast(null as {{ type_string() }}) as node_id,
cast(null as {{ type_timestamp() }}) as run_started_at,
cast(null as {{ type_boolean() }}) as was_full_refresh,
cast(null as {{ type_string() }}) as thread_id,
cast(null as {{ type_string() }}) as status,
cast(null as {{ type_timestamp() }}) as compile_started_at,
cast(null as {{ type_timestamp() }}) as query_completed_at,
cast(null as {{ type_float() }}) as total_node_runtime,
cast(null as {{ type_int() }}) as rows_affected,
cast(null as {{ type_string() }}) as materialization,
cast(null as {{ type_string() }}) as schema,
cast(null as {{ type_string() }}) as name,
cast(null as {{ type_string() }}) as alias,
cast(null as {{ type_string() }}) as message,
cast(null as {{ type_json() }}) as adapter_response
cast(null as {{ type_string() }}) as command_invocation_id
, cast(null as {{ type_string() }}) as node_id
, cast(null as {{ type_timestamp() }}) as run_started_at
, cast(null as {{ type_boolean() }}) as was_full_refresh
, cast(null as {{ type_string() }}) as thread_id
, cast(null as {{ type_string() }}) as status
, cast(null as {{ type_timestamp() }}) as compile_started_at
, cast(null as {{ type_timestamp() }}) as query_completed_at
, cast(null as {{ type_float() }}) as total_node_runtime
, cast(null as {{ type_int() }}) as rows_affected
, cast(null as {{ type_string() }}) as materialization
, cast(null as {{ type_string() }}) as schema
, cast(null as {{ type_string() }}) as name
, cast(null as {{ type_string() }}) as alias
, cast(null as {{ type_string() }}) as message
, cast(null as {{ type_json() }}) as adapter_responss
from dummy_cte
where 1 = 0
33 changes: 18 additions & 15 deletions models/sources/seeds.sql
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
/* Bigquery won't let us `where` without `from` so we use this workaround */
with dummy_cte as (
select 1 as foo
)
with
dummy_cte as (

select 1 as foo

)

select
cast(null as {{ type_string() }}) as command_invocation_id,
cast(null as {{ type_string() }}) as node_id,
cast(null as {{ type_timestamp() }}) as run_started_at,
cast(null as {{ type_string() }}) as database,
cast(null as {{ type_string() }}) as schema,
cast(null as {{ type_string() }}) as name,
cast(null as {{ type_string() }}) as package_name,
cast(null as {{ type_string() }}) as path,
cast(null as {{ type_string() }}) as checksum,
cast(null as {{ type_json() }}) as meta,
cast(null as {{ type_string() }}) as alias,
cast(null as {{ type_json() }}) as all_results
cast(null as {{ type_string() }}) as command_invocation_id
, cast(null as {{ type_string() }}) as node_id
, cast(null as {{ type_timestamp() }}) as run_started_at
, cast(null as {{ type_string() }}) as database
, cast(null as {{ type_string() }}) as schema
, cast(null as {{ type_string() }}) as name
, cast(null as {{ type_string() }}) as package_name
, cast(null as {{ type_string() }}) as path
, cast(null as {{ type_string() }}) as checksum
, cast(null as {{ type_json() }}) as meta
, cast(null as {{ type_string() }}) as alias
, cast(null as {{ type_json() }}) as all_results
from dummy_cte
where 1 = 0
41 changes: 22 additions & 19 deletions models/sources/snapshot_executions.sql
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
/* Bigquery won't let us `where` without `from` so we use this workaround */
with dummy_cte as (
select 1 as foo
)
with
dummy_cte as (

select 1 as foo

)

select
cast(null as {{ type_string() }}) as command_invocation_id,
cast(null as {{ type_string() }}) as node_id,
cast(null as {{ type_timestamp() }}) as run_started_at,
cast(null as {{ type_boolean() }}) as was_full_refresh,
cast(null as {{ type_string() }}) as thread_id,
cast(null as {{ type_string() }}) as status,
cast(null as {{ type_timestamp() }}) as compile_started_at,
cast(null as {{ type_timestamp() }}) as query_completed_at,
cast(null as {{ type_float() }}) as total_node_runtime,
cast(null as {{ type_int() }}) as rows_affected,
cast(null as {{ type_string() }}) as materialization,
cast(null as {{ type_string() }}) as schema,
cast(null as {{ type_string() }}) as name,
cast(null as {{ type_string() }}) as alias,
cast(null as {{ type_string() }}) as message,
cast(null as {{ type_json() }}) as adapter_response
cast(null as {{ type_string() }}) as command_invocation_id
, cast(null as {{ type_string() }}) as node_id
, cast(null as {{ type_timestamp() }}) as run_started_at
, cast(null as {{ type_boolean() }}) as was_full_refresh
, cast(null as {{ type_string() }}) as thread_id
, cast(null as {{ type_string() }}) as status
, cast(null as {{ type_timestamp() }}) as compile_started_at
, cast(null as {{ type_timestamp() }}) as query_completed_at
, cast(null as {{ type_float() }}) as total_node_runtime
, cast(null as {{ type_int() }}) as rows_affected
, cast(null as {{ type_string() }}) as materialization
, cast(null as {{ type_string() }}) as schema
, cast(null as {{ type_string() }}) as name
, cast(null as {{ type_string() }}) as alias
, cast(null as {{ type_string() }}) as message
, cast(null as {{ type_json() }}) as adapter_response
from dummy_cte
where 1 = 0
Loading

0 comments on commit 504a683

Please sign in to comment.