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

dbt_utils 1.0 fails to handle empty strings in slugify #773

Closed
1 of 5 tasks
atvaccaro opened this issue Mar 24, 2023 · 6 comments · Fixed by #912
Closed
1 of 5 tasks

dbt_utils 1.0 fails to handle empty strings in slugify #773

atvaccaro opened this issue Mar 24, 2023 · 6 comments · Fixed by #912
Labels
bug Something isn't working

Comments

@atvaccaro
Copy link
Contributor

atvaccaro commented Mar 24, 2023

Describe the bug

In the 1.0 release, dbt_utils.slugify was changed to prepend an underscore if the string has a leading digit, but fails to handle empty strings.

Steps to reproduce

Call dbt_utils.slugify('').

Expected results

I think an empty string should be returned, rather than the user having to check if the string is empty first.

Actual results

A compilation error is raised with str object has no element 0.

Screenshots and log output

When compiling a model that calls slugify.

15:39:45  Encountered an error:
Compilation Error in model fct_payments_rides_v2 (models/mart/payments/fct_payments_rides_v2.sql)
  str object has no element 0

  > in macro create_row_access_policy (macros/create_row_access_policy.sql)
  > called by macro slugify (macros/jinja_helpers/slugify.sql)
  > called by model fct_payments_rides_v2 (models/mart/payments/fct_payments_rides_v2.sql)

System information

The contents of your packages.yml file:

packages:
  - package: dbt-labs/dbt_utils
    version: 1.0.0
  - package: calogica/dbt_expectations
    version: [">=0.8.0", "<0.9.0"]

Which database are you using dbt with?

  • postgres
  • redshift
  • bigquery
  • snowflake
  • other (specify: ____________)

The output of dbt --version:
dbt --version actually hangs for me right now 🤔

Additional context

see link above

Are you interested in contributing the fix?

Sure I think it's a 1-line change.

@atvaccaro atvaccaro added bug Something isn't working triage labels Mar 24, 2023
@joellabes
Copy link
Contributor

Hey @atvaccaro, good catch! I'd welcome a fix for this - agreed that if it's an empty string, we can just return the empty string.

Please also add a test for this in the slugify tests model

@github-actions
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 Sep 24, 2023
@github-actions
Copy link

github-actions bot commented Oct 1, 2023

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 Oct 1, 2023
@dbeatty10 dbeatty10 removed the Stale label Apr 18, 2024
@dbeatty10 dbeatty10 reopened this Apr 18, 2024
@karthik-viswanathan-alludo

Hi all, did we find a fix for this. I am encountering this issue and would appreciate any help to fix it. Thanks.

@dkeyer-twilio
Copy link

Hi all, did we find a fix for this. I am encountering this issue and would appreciate any help to fix it. Thanks.

+1

@dbeatty10
Copy link
Contributor

@dkeyer-twilio this has been fixed in main, but it has not been released yet. It will be included in our next release (which hasn't been scheduled yet).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
5 participants