Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bool coercion to 0/1 #4512

Merged
merged 2 commits into from
Dec 19, 2021
Merged

Fix bool coercion to 0/1 #4512

merged 2 commits into from
Dec 19, 2021

Conversation

jtcohen6
Copy link
Contributor

@jtcohen6 jtcohen6 commented Dec 17, 2021

resolves #4511

This is a better fix because it:

-- models/any_model.sql
{% if execute %}

  {% set results = run_query('''
    select true as my_boolean_column, 0 as my_numeric_column
    union all
    select false, 1
  ''') %}

  {{ results.print_table() }}

{% endif %}

Before:

| my_boolean_column | my_numeric_column |
| ----------------- | ----------------- |
|                 1 |                 0 |
|                 0 |                 1 |

After:

| my_boolean_column | my_numeric_column |
| ----------------- | ----------------- |
|              True |                 0 |
|             False |                 1 |

@jtcohen6 jtcohen6 requested a review from leahwicz December 17, 2021 23:46
@cla-bot cla-bot bot added the cla:yes label Dec 17, 2021
@leahwicz leahwicz added this to the v1.0.1 milestone Dec 18, 2021
@leahwicz leahwicz merged commit 417ccdc into main Dec 19, 2021
@leahwicz leahwicz deleted the fix/4511-agate-bool-coercion branch December 19, 2021 15:30
leahwicz pushed a commit that referenced this pull request Dec 19, 2021
* Fix bool coercion

* Fix unit test
leahwicz added a commit that referenced this pull request Dec 20, 2021
* Fix bool coercion

* Fix unit test

Co-authored-by: Jeremy Cohen <[email protected]>
iknox-fa pushed a commit that referenced this pull request Feb 8, 2022
* Fix bool coercion

* Fix unit test

automatic commit by git-black, original commits:
  417ccdc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bools coerced to 0/1 in query results
2 participants