From 21cc2e623cefbd39570f2096368617a73d3ceba4 Mon Sep 17 00:00:00 2001 From: swanderz Date: Thu, 24 Jun 2021 10:59:59 -0700 Subject: [PATCH] fix for empty seed tables --- CHANGELOG.md | 4 ++++ dbt/adapters/sqlserver/impl.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ed8ce08..be242ae4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog ### v0.19.2 +#### fixes + +- fixing and issue with empty seed table that dbt-redshift already addressed with [fishtown-analytics/dbt#2255](https://github.com/fishtown-analytics/dbt/pull/2255) [#147](https://github.com/dbt-msft/dbt-sqlserver/pull/147) + #### under the hood: - hotfix for regression introduced by [#126](https://github.com/dbt-msft/dbt-sqlserver/issues/126) that wouldn't surface syntax errors from the SQL engine [#140](https://github.com/dbt-msft/dbt-sqlserver/issues/140) thanks [@jeroen-mostert](https://github.com/jeroen-mostert)! diff --git a/dbt/adapters/sqlserver/impl.py b/dbt/adapters/sqlserver/impl.py index 8cab4554..21acb806 100644 --- a/dbt/adapters/sqlserver/impl.py +++ b/dbt/adapters/sqlserver/impl.py @@ -18,7 +18,8 @@ def date_function(cls): @classmethod def convert_text_type(cls, agate_table, col_idx): column = agate_table.columns[col_idx] - lens = (len(d.encode("utf-8")) for d in column.values_without_nulls()) + # see https://github.com/fishtown-analytics/dbt/pull/2255 + lens = [len(d.encode("utf-8")) for d in column.values_without_nulls()] max_len = max(lens) if lens else 64 length = max_len if max_len > 16 else 16 return "varchar({})".format(length)