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

Incremental load based on several columns #86

Open
edwin-aguilar-iwar opened this issue Jan 20, 2025 · 1 comment
Open

Incremental load based on several columns #86

edwin-aguilar-iwar opened this issue Jan 20, 2025 · 1 comment

Comments

@edwin-aguilar-iwar
Copy link

Hi, I have a table that should be incrementally loaded based on several timestamp columns (timecreated, timemodified, lastaccess, lastlogin). I'm currently loading this table via only timemodified as I (incorrectly) thought that it got updated whenever any of the other 3 got updated. However, this is not the case. Hence, I have some records that are not up to date.

Is there a way to specify multiple incremental keys? Or would the correct strategy be to perform different loads per incremental key (in this case, I would have to execute the ingestr command 4 times). If this is the case, what impact would it have on the state that is managed behind doors?

Thanks!

@turtleDev
Copy link
Contributor

turtleDev commented Jan 21, 2025

Hi @edwin-aguilar-iwar

ingestr currently only supports incremental loads using a single column. This isn't strictly a technical limitation, but a sensible convention we adhere to.

With regards to your specific scenario, I can suggest the following:

  • can you create a view over your table that can create a column called last_updated as greatest(timecreated,timemodified,lastaccess,lastlogin) and use that as your incremental key?
  • if creating a view is not possible, you can use custom queries to project a last_updated column and filter it manually. Here's an example: query: select *, greatest(timecreated, timemodified, lastaccess, lastlogin) as last_updated from table

Would any of these solutions be feasible for you?

P.S. it would be helpful to know the ingestr version and source that you're using.

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

No branches or pull requests

2 participants