Combine tables using ETL inner join
Hi everyone,
I'm trying to combine two federated tables using the inner join in Magic ETL.
Both tables have over 9.5M rows but when I join them, the result is only 87K.
I tested the join in Snowflake and it resulted in 9.5M by the logic:
SELECT *
FROM 'A'
INNER JOIN 'B'
ON A.X = B.X
What could i be doing wrong?
*I'll need to join other tables after the join I mentioned above, in the same ETL
Answers
-
Here are a couple common issues with joins in Magic ETL
- It is case sensitive
- Leading or trailing spaces
An easy way to address both of these is to add a formula tile to each table prior to the join and use the following functions
UPPER() - converts the text field to uppercase
TRIM() - removes any leading or trailing spaces
You can do this in a single function like this TRIM(UPPER(fieldname))
Try doing this prior to your join and see if that works.
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.1 -
Second what Mark said.
Also, for problem solving. I'd take a small sample of the ones that didn't join and compare them between the two tables. Will probably find what Mark said and there are some leading or trailing blank spaces or case sensitivity.
1 -
Thank you for help.
I tried to uso TRIM and UPPER and the matched rows jumped from 87K to 94k.
I inclued the REPLACE(fieldname, ' ', '') as well, to remove all leading spaces, so jumped to 134k.
It's far from the real match rows number, but looks like it is a format divergence.
Checking the data in the table I didn't see any different format, as shown in the image below:
0 -
Is it also possible that some of your rows don't have leading zeros and some do? If so, you can use the LPAD() function to add leading zeros if everything should be a certain number of characters.
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.1 -
Have zeros completing the number, but they already come with.
I tried with LPAD() and the matched rows were reduce to 112k.
I don't know if it's related, but I brought the data from SAP by federated connection, so I created a view of this dataset.
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.8K Visualize
- 2.5K Charting
- 737 Beast Mode
- 56 App Studio
- 40 Variables
- 684 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 46 Workflows
- 10 DomoAI
- 35 Predict
- 14 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 123 Manage
- 120 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive