-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into dependabot/pip/mypy-1.11.2
- Loading branch information
Showing
21 changed files
with
729 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
version = "1.8.0rc1" | ||
version = "1.8.0rc2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{% macro sqlserver__get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%} | ||
|
||
-- Create target schema if it does not | ||
USE [{{ target.database }}]; | ||
IF NOT EXISTS (SELECT * FROM sys.schemas WHERE name = '{{ target.schema }}') | ||
BEGIN | ||
EXEC('CREATE SCHEMA [{{ target.schema }}]') | ||
END | ||
|
||
{% set with_statement_pattern = 'with .+ as\s*\(' %} | ||
{% set re = modules.re %} | ||
{% set is_match = re.search(with_statement_pattern, main_sql, re.IGNORECASE) %} | ||
|
||
{% if is_match %} | ||
{% set testview %} | ||
[{{ target.schema }}.testview_{{ range(1300, 19000) | random }}] | ||
{% endset %} | ||
|
||
{% set sql = main_sql.replace("'", "''")%} | ||
EXEC('create view {{testview}} as {{ sql }};') | ||
select | ||
{{ "top (" ~ limit ~ ')' if limit != none }} | ||
{{ fail_calc }} as failures, | ||
case when {{ fail_calc }} {{ warn_if }} | ||
then 'true' else 'false' end as should_warn, | ||
case when {{ fail_calc }} {{ error_if }} | ||
then 'true' else 'false' end as should_error | ||
from ( | ||
select * from {{testview}} | ||
) dbt_internal_test; | ||
|
||
EXEC('drop view {{testview}};') | ||
|
||
{% else -%} | ||
select | ||
{{ "top (" ~ limit ~ ')' if limit != none }} | ||
{{ fail_calc }} as failures, | ||
case when {{ fail_calc }} {{ warn_if }} | ||
then 'true' else 'false' end as should_warn, | ||
case when {{ fail_calc }} {{ error_if }} | ||
then 'true' else 'false' end as should_error | ||
from ( | ||
{{ main_sql }} | ||
) dbt_internal_test | ||
{%- endif -%} | ||
{%- endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{% macro sqlserver__get_binding_char() %} | ||
{{ return('?') }} | ||
{% endmacro %} | ||
|
||
{% macro sqlserver__get_batch_size() %} | ||
{{ return(400) }} | ||
{% endmacro %} | ||
|
||
{% macro calc_batch_size(num_columns) %} | ||
{# | ||
SQL Server allows for a max of 2098 parameters in a single statement. | ||
Check if the max_batch_size fits with the number of columns, otherwise | ||
reduce the batch size so it fits. | ||
#} | ||
{% set max_batch_size = get_batch_size() %} | ||
{% set calculated_batch = (2098 / num_columns)|int %} | ||
{% set batch_size = [max_batch_size, calculated_batch] | min %} | ||
|
||
{{ return(batch_size) }} | ||
{% endmacro %} | ||
|
||
{% macro sqlserver__load_csv_rows(model, agate_table) %} | ||
{% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %} | ||
{% set batch_size = calc_batch_size(agate_table.column_names|length) %} | ||
{% set bindings = [] %} | ||
{% set statements = [] %} | ||
|
||
{{ log("Inserting batches of " ~ batch_size ~ " records") }} | ||
|
||
{% for chunk in agate_table.rows | batch(batch_size) %} | ||
{% set bindings = [] %} | ||
|
||
{% for row in chunk %} | ||
{% do bindings.extend(row) %} | ||
{% endfor %} | ||
|
||
{% set sql %} | ||
insert into {{ this.render() }} ({{ cols_sql }}) values | ||
{% for row in chunk -%} | ||
({%- for column in agate_table.column_names -%} | ||
{{ get_binding_char() }} | ||
{%- if not loop.last%},{%- endif %} | ||
{%- endfor -%}) | ||
{%- if not loop.last%},{%- endif %} | ||
{%- endfor %} | ||
{% endset %} | ||
|
||
{% do adapter.add_query(sql, bindings=bindings, abridge_sql_log=True) %} | ||
|
||
{% if loop.index0 == 0 %} | ||
{% do statements.append(sql) %} | ||
{% endif %} | ||
{% endfor %} | ||
|
||
{# Return SQL so we can render it out into the compiled files #} | ||
{{ return(statements[0]) }} | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
dbt-tests-adapter>=1.8.0, <1.9.0 | ||
|
||
ruff | ||
black==24.2.0 | ||
black==24.8.0 | ||
bumpversion | ||
flake8 | ||
flaky | ||
|
Oops, something went wrong.