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

Get and reset T_Id Sequence #71

Merged
merged 7 commits into from
Nov 17, 2023
Merged

Get and reset T_Id Sequence #71

merged 7 commits into from
Nov 17, 2023

Conversation

signedav
Copy link
Member

@signedav signedav commented Nov 10, 2023

This is a very powerful thingy that should be handled very carefully.

Reset the Sequences

GPKG

UPDATE T_KEY_OBJECT SET T_LastUniqueID = 10 WHERE T_Key = 'T_Id'

PG

ALTER SEQUENCE oid_madness_01.t_ili2db_seq RESTART WITH 20;

Limitations or "What is with conflicts?"

GPKG

When resetting the value and then run into conflicts.
image

Because of the unique constraints it just counts it up - means it continues to work with the tablewide t_id (I guess it takes the Geopackage Function AUTOGENERATE)...

Our t_ili_tids are of course fucked up then...

On another table of course it works but on validation of course it has troubles then because of duplicates.

PG

Similar but not same on postgres. When resetting the sequence, it just counts up with it, but because of unique constraint it cannot store the feature.

image

On another table of course it works but on validation of course it has troubles then because of duplicates.

@signedav
Copy link
Member Author

Upsi. Wrong model in pg test. Will fix it...

@signedav signedav marked this pull request as ready for review November 16, 2023 14:05
@signedav signedav requested a review from domi4484 November 16, 2023 14:05
modelbaker/iliwrapper/ili2dbutils.py Outdated Show resolved Hide resolved
@signedav signedav merged commit e43e917 into main Nov 17, 2023
4 checks passed
@signedav signedav deleted the sequence branch November 17, 2023 09:29
).format(value)
except pyodbc.errors.Error as e:
error_message = " ".join(e.args)
return False, self.tr("Could not reset sequence: {}").format(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would not be better to throw an exception instead of returning false? I'm thinking more general that only this case. Or is it a design décision for the library?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oopsi. Haven't seen this before merging. Good input, but I wanted it to make it identical to other functions. Some (e.g.) create_baskets are called for multiple baskets, where in the frontend I 'collect' all the feedbacks and return it in a list. Kind of "5 of 10 baskets are not created" or similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants