Selecting only newer records from a remote datasource to append to a Domo datasource
Hi here…
When setting up a query to grab data from a remote datasource and append to data in DOMO. Is there a way to grab newer records based on the data that was previously imported.
Page: DATA / <DATASET NAME> / SETTINGS / QUERY
I'd like to run something like:
SELECT *
FROM myRemoteDataSchema.myDataSet
← remote dataset
WHERE dateField > (Select max(dateField) from domo.myDataSet
) ← current Domo dataset
Best Answers
-
@JohnnyN What kind of connector are you using to pull this data? If possible, I'd suggest setting the update method of your dataset to Append, then aligning your query and update schedule so that it always pulls data since the last time the dataset ran.
For example, if you have your connector set to run once a day then you could write your query to only pull data from the previous day.
SELECT *
FROMmyRemoteDataSchema.myDataSet
WHERE dateField = CURRENT_DATE() - 11 -
@JohnnyN - Depending on how you are bringing the data into Domo, you could also change your dataset to be an upsert. If you search the knowledge base for upsert you should be able to see which connectors have this option.
“There is a superhero in all of us, we just need the courage to put on the cape.” -Superman1
Answers
-
@JohnnyN What kind of connector are you using to pull this data? If possible, I'd suggest setting the update method of your dataset to Append, then aligning your query and update schedule so that it always pulls data since the last time the dataset ran.
For example, if you have your connector set to run once a day then you could write your query to only pull data from the previous day.
SELECT *
FROMmyRemoteDataSchema.myDataSet
WHERE dateField = CURRENT_DATE() - 11 -
@JohnnyN - Depending on how you are bringing the data into Domo, you could also change your dataset to be an upsert. If you search the knowledge base for upsert you should be able to see which connectors have this option.
“There is a superhero in all of us, we just need the courage to put on the cape.” -Superman1 -
Hi @MichelleH Yup I am
appending
I have had this method running already. But we had a problem down stream where yesterdays data failed to populated in our datawarehouse. Meaning when the import runs tomorrow I would need to fetchWHERE dateField = CURRENT_DATE() - 2
If I could understand what date was last fetched… maybemax(_BATCH_LAST_RUN_)
I could do the math to get the section of records to Append to DOMO.
Hope that makes sense.0 -
@JohnnyN In that case I would follow @ST_-Superman-_'s suggestion in trying an upsert dataset so you can bring in a rolling X number of days without duplicating.
0 -
@MichelleH OK I didnt hear "rolling X number of days " previously. Yes that sounds like a plan.
0 -
@MichelleH Yup… I'm rolling 4 days worth of data and merging into DOMO. This should cover me for outage over the W/E maybe. As the data is an audit. Most of the historical data selected should be ignored and only new records inserted from the last inserted record.
Seems to be working well. Thanks1
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
- 738 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