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

45 explode json array operation #46

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

fatchat
Copy link
Contributor

@fatchat fatchat commented Nov 9, 2023

copilot:all

@fatchat fatchat linked an issue Nov 9, 2023 that may be closed by this pull request
@codecov-commenter
Copy link

Codecov Report

Attention: 65 lines in your changes are missing coverage. Please review.

Comparison is base (d590848) 80.20% compared to head (12c543d) 73.87%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #46      +/-   ##
==========================================
- Coverage   80.20%   73.87%   -6.33%     
==========================================
  Files          19       20       +1     
  Lines         697      758      +61     
==========================================
+ Hits          559      560       +1     
- Misses        138      198      +60     
Files Coverage Δ
dbt_automation/utils/postgres.py 68.91% <55.55%> (-1.51%) ⬇️
dbt_automation/utils/bigquery.py 56.12% <54.54%> (-1.17%) ⬇️
dbt_automation/operations/explodejsonarray.py 0.00% <0.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fatchat
Copy link
Contributor Author

fatchat commented Jan 23, 2025

cannot have two jsonb_array_elements in a single query, instead if we need to extract multiple columns from each exploded json object we need to LATERAL join the table against the jsonb_array_elements' output

e.g.

SELECT  _id,   
    kpi_element->>'_id' as kpi_id,   
    kpi_element->>'name' as kpi_name 
FROM  "MongoDB"."projects",  LATERAL jsonb_array_elements(_kpi::jsonb) AS kpi_element 

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.

explode-json-array operation
2 participants