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

get_single_value sql macro: default value condition can not be satisfied #804

Closed
4 tasks
marrigault opened this issue Jun 12, 2023 · 4 comments
Closed
4 tasks
Labels
bug Something isn't working Stale triage

Comments

@marrigault
Copy link

marrigault commented Jun 12, 2023

Describe the bug

Default value is not used when sql statement of get_single_value macro do not return any result

Steps to reproduce

Sql statement on empty table or whatever query that do not return any result

Expected results

get_single_value macro should return default parameter when query is not returning a single value

Actual results

get_single_value macro return None as a result

Screenshots and log output

System information

The contents of your packages.yml file:

  • package: dbt-labs/dbt_utils
    version: 1.0.0

Which database are you using dbt with?

  • postgres
  • redshift
  • [ x] bigquery
  • snowflake
  • other (specify: ____________)

The output of dbt --version:

Core:
  - installed: 1.3.0
  - latest:    1.5.1 - Update available!

  Your version of dbt-core is out of date!
  You can find instructions for upgrading here:
  https://docs.getdbt.com/docs/installation

Plugins:
  - bigquery: 1.3.0 - Update available!

Additional context

I think line 18: {% if r | length == 0 %}
could be replaced with
{% if not r[0] %} (or maybe {% if not (r and r[0]) %} )
because r has a value even if query has no result

Are you interested in contributing the fix?

@marrigault marrigault added bug Something isn't working triage labels Jun 12, 2023
@tsafacjo
Copy link

tsafacjo commented Nov 1, 2023

can I take it ?

@marrigault
Copy link
Author

marrigault commented Nov 1, 2023 via email

Copy link

This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days.

@github-actions github-actions bot added the Stale label Apr 30, 2024
Copy link

github-actions bot commented May 7, 2024

Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Stale triage
Projects
None yet
Development

No branches or pull requests

2 participants