-
Notifications
You must be signed in to change notification settings - Fork 36
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
[Bug] Errors when extracting JSON values #45
Comments
Hi @LewisDavies thanks so much for opening this issue. This is a very interesting error you are coming across. I have a few quick questions to better understand the root of the issue:
In addition to the above questions, I feel the vars:
stripe__plan_metadata: ['"set"','feature.id','etc.'] I am not positive it will work, but would be worth the try! I will keep digging in on my end to see if there is a better way to address the reserved word issue. In the meantime, it would be great if you could help provide details to my above questions as well. Thanks so much again for raising this with our team 😄 |
Hey @fivetran-joemarkiewicz, sorry for the slow reply.
It's failing when the package tries to set a column name containing |
No worries at all @LewisDavies thanks for sharing more information on the issue you are experiencing. Let me try and fiddle around with this a bit and see what I can come back with regarding this parsing issue. 🤔 |
Hey @fivetran-reneeli, here are a couple of models that don't pull through the metadata fields. The logic is all there, the columns have just been excluded from the final output.
I checked
|
Hi @LewisDavies ! Thank you for details and appreciate you linking the models.
|
Hi All,
When I check out the compiled SQL I can see a field called
This is failing because on BigQuery I believe here that, to ensure issues like this do not happen, at least in BigQuery, they should be quoted using the tick so that reserved words can be referenced in a query i.e.:
The above SQL now passes and the model is able to run. Can this be looked into please? It is worth noting that I am not using any |
Looking at the solution above on using the
This is the SQL that is produced, and as you can see at the top of the query, the keyword is still used, whereas the |
Hi @CraigWilson-ZOE thanks for raising this with out team. I think the issue you are detailing is different from the original issue outlined in this Bug Report. This bug report was detailing reserved words within the Your bug however, is a field that is explicitly being selected within the model (regardless of the var) and could not be addressed using the metadata solution outlined in this bug report. I did try to recreate the issue you had using the latest version of the package(s) and saw the The quoting should be happening within the get_plan_columns macro from the source package. The only way I could see dbt skipping over the quote is if the For a more immediate fix, you may be able to downgrade just your stripe_source package to |
Ah! I think you have solved the issue for me actually. We are using the Here is a excerpt from our default:
target: development
outputs:
development:
type: fal
threads: 16
db_profile: warehouse
warehouse:
type: bigquery
method: oauth I am wondering how we might be able to get around this or have this changed to deal with these new type of adapters 🤔 |
@CraigWilson-ZOE that is definitely interesting and thanks for sharing! I can see how this would cause an error for you with the target.type not matching our supported warehouses target.type names. That being said, you are using BigQuery so I still feel this can be supported. I am just not entirely familiar with the fal target and how it differs from the basic BigQuery target. As this is a different conversation from the one being had within this issue, I have opened a new FR on the source package (linked above) for us to continue the discussion. Feel free to add more context within that ticket. |
Closing this out as we have updated the package to allow for the metadata json field to be pivoted out. For instructions on how to correctly set it up we've included info in the README! |
Is there an existing issue for this?
Describe the issue
I'm trying to use the metadata list variables, e.g.
stripe__plan_metadata
, to specify the fields to extract but I'm seeing two distinct error pattens:feature.id
, the package tries to use the same value as a column name. This fails because column names can't contain.
.set
. Snowflake expects this to set a session variable, which causes an error.Relevant error log or model output
Expected behavior
Ideally, columns should be created from the metadata with valid names. However, I imagine there are a ton of corner cases regarding character substitution and reserved keywords.
An alternative approach would be to pass metadata fields to the final models without modification. This would let users parse the values in a separate view.
dbt Project configurations
vars:
stripe__plan_metadata:
- archived
- feature.handle
- feature.id
- feature.type
- generated
- limit
- plan.id
- plan.handle
- set
- version
Package versions
packages:
version: 0.7.1
What database are you using dbt with?
snowflake
dbt Version
Core:
Plugins:
Additional Context
No response
Are you willing to open a PR to help address this issue?
The text was updated successfully, but these errors were encountered: