Skip to content

Fix expect_column_to_exist rendering Python booleans as SQL literals#45

Merged
GuruM merged 1 commit into
metaplane:mainfrom
sdebruyn:fix/expect-column-to-exist-boolean-literals
May 17, 2026
Merged

Fix expect_column_to_exist rendering Python booleans as SQL literals#45
GuruM merged 1 commit into
metaplane:mainfrom
sdebruyn:fix/expect-column-to-exist-boolean-literals

Conversation

@sdebruyn
Copy link
Copy Markdown
Contributor

Summary

  • Replaces Python True/False with integer literals 1/0 in the expect_column_to_exist test macro
  • Adds = 1 comparison in the WHERE clause instead of relying on implicit boolean evaluation
  • T-SQL (Microsoft Fabric, SQL Server, Azure SQL) has no boolean type, so True/False are invalid SQL literals on those platforms

Fixes #43

Test plan

  • Run expect_column_to_exist test on a T-SQL adapter (dbt-fabric, dbt-sqlserver) — should no longer error
  • Run expect_column_to_exist test on PostgreSQL/Snowflake/BigQuery — should still pass (integer 1/0 work as booleans on all platforms)
  • Test with and without the column_index parameter

Use integer literals (1/0) instead of Python True/False, which are not
valid SQL on T-SQL dialects (Microsoft Fabric, SQL Server, Azure SQL).

Fixes metaplane#43
Copilot AI review requested due to automatic review settings May 17, 2026 11:26
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes expect_column_to_exist SQL rendering for T-SQL-based adapters by avoiding Python boolean literals in generated SQL.

Changes:

  • Replaces rendered true/false values with integer 1/0.
  • Updates the final predicate to compare the integer flag explicitly with = 1.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@GuruM GuruM merged commit 807a77c into metaplane:main May 17, 2026
5 of 6 checks passed
@sdebruyn sdebruyn deleted the fix/expect-column-to-exist-boolean-literals branch May 17, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

expect_column_to_exist renders Python True/False as SQL literals

3 participants