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

Checked map length to prevent errors #58

Merged
merged 2 commits into from
Oct 30, 2023

Conversation

lvarley
Copy link
Contributor

@lvarley lvarley commented Oct 29, 2023

resolves #

Not sure if there is an existing logged issue for this, however:

Description

This is a fix to an error I get with my manifest.json using dbt-core 1.6.6 and snowflake-adapter 1.6.4. Possibly due to dynamic tables or quoted columns I couldn't quite work it out

  File "/dbterd/adapters/algos/test_relationship.py", line 170, in get_table_map
    if f'("{map[1].split(".")[-1]}")'.lower() in to_model.replace("'", '"').lower():
IndexError: list index out of range

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have opened an issue to add/update docs, or docs changes are not required/relevant for this PR

@codecov
Copy link

codecov bot commented Oct 29, 2023

Codecov Report

Merging #58 (f810919) into main (81ed668) will decrease coverage by 0.09%.
Report is 5 commits behind head on main.
The diff coverage is 95.65%.

❗ Current head f810919 differs from pull request most recent head 89a2640. Consider uploading reports for the commit 89a2640 to get more accurate results

@@             Coverage Diff             @@
##              main      #58      +/-   ##
===========================================
- Coverage   100.00%   99.91%   -0.09%     
===========================================
  Files           43       43              
  Lines         1130     1137       +7     
===========================================
+ Hits          1130     1136       +6     
- Misses           0        1       +1     
Files Coverage Δ
dbterd/adapters/algos/base.py 100.00% <100.00%> (ø)
dbterd/adapters/filter.py 100.00% <100.00%> (ø)
dbterd/adapters/meta.py 100.00% <100.00%> (ø)
dbterd/cli/params.py 100.00% <100.00%> (ø)
...ests/unit/adapters/algos/test_test_relationship.py 100.00% <100.00%> (ø)
...t/adapters/targets/d2/test_d2_test_relationship.py 100.00% <ø> (ø)
...apters/targets/dbml/test_dbml_test_relationship.py 100.00% <ø> (ø)
...argets/graphviz/test_graphviz_test_relationship.py 100.00% <ø> (ø)
.../targets/mermaid/test_mermaid_test_relationship.py 100.00% <ø> (ø)
...argets/plantuml/test_plantuml_test_relationship.py 100.00% <ø> (ø)
... and 2 more

@datnguye
Copy link
Owner

Hi @lvarley thanks for proactively flag it out and having the PR 💯

Could you help to give a sample for reproducing? Or may be a whole manifest.json file? Thanks a lot

@datnguye
Copy link
Owner

Thanks @lvarley I got your email of the attached manifest.json
I see the issue which is the root caused by the column quote (") in snowflake.

I have a comment on the change, could you help to make a change? I am happy to make it otherwise

  • Revert your current change
  • Change Line 87 and Line 96: remove double quote
).lower(),

to:

).replace("\"","").lower(),
  • For more context, in DBML syntax, it doesn't support to escape double quote, we can only ignore it though

Thanks

Remove incompatible double quoted columns
@datnguye datnguye merged commit 7bd87a0 into datnguye:main Oct 30, 2023
1 of 10 checks passed
@lvarley lvarley deleted the fix_manifest_parsing branch October 31, 2023 00:36
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.

2 participants