Closed yokofly closed 1 month ago
@flarco plz care about the full workflow, even though the code is pretty simple. but I have not tested the presql and postsql.. my locally simple tests looks good/expected ^
a tricky issue: I was trying to load a CSV file into the database using incremental mode to update specific keys.
previous, sling default infer some of column type as int64, actually the type is int32, and upsert
can handle this well.
with this pr: the dataflow type is int64, then cannot convert to int32, this adds some complexity.
I have no better solution.
I have a basic solution: add a special check: if the target table existed, we use the target table type for loading dataflow. instead, infer.
so the type comes from: first check Config, if we specified use config type second check that the Target table if exists, we use the target table type finally, let's make infer.
another issue: incremental mode from csv to database, it will try to compare the count. but actually, the update key comparison finds no need to insert(or insert 0 ROWS), but finally, it will get an inconsistent count. we need a way to notify this inconsistent is because update_key comparison result?
thanks @yokofly will spend time on this tomorrow
@flarco to sum up: here are 2 issues I found in my current code:
upsert
to handle some column type incorrectly but still can be inserted from temp table to target, but now we do not have such a guard. so we need adjust column type directly from target if there is?(ideally we shall tell the user to create target table first by themselves?)hi @flarco do u have any idea about the above 2 issues? Or It would be much appreciated if you can work on this, I am not familiar with df type change/sync status.
@yokofly Yes, I will. I think this will need more time to get right, the logic standing today has been developed over many iterations, and can get tricky. Thanks for all this, I'll take this on from here to get this merged into the next version. The plan is to release 1.2.21 tomorrow, since tests are passing (without this PR merged). Don't want to delay the release further.
@yokofly Can you edit the PR to merge into branch v1.2.22
? It auto-closed this one and doesn't let me change it.
ok
try fix #35 usage: export SLING_ALLOW_DIRECT_INSERT=true current if we stop the insert to the target table, the rollback will do nothing, because the target table is directly inserted.