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

record id should not change between script executions #1893

Merged
merged 1 commit into from Mar 21, 2024

Conversation

TBonnin
Copy link
Collaborator

@TBonnin TBonnin commented Mar 21, 2024

Describe your changes

Currently the record internal id is modified every time a record is updated which is counter intuitive and makes debugging harder

With this commit a record id is now a uuid v5 generated from the unique composite key (connection, model, external id)

Currently the record internal id is modified every time a record is
updated which is counter intuitive and makes debugging harder

With this commit a record id is now a uuid v5 generated from the unique
composite key (connection, model, external id)
// to generate stable record ids across script executions
const stableId = (rawRecord: DataResponse): string => {
const namespace = uuid.v5(`${nango_connection_id}${model}`, uuid.NIL);
return uuid.v5(`${nango_connection_id}${model}${rawRecord.id}`, namespace);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

having a namespace hierarchy is not mandatory, we could use a constant root namespace. Let me know what you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

could be just nango_connection_id yes, otherwise I'm fine with this

@TBonnin TBonnin merged commit 9185b88 into master Mar 21, 2024
18 checks passed
@TBonnin TBonnin deleted the tbonnin/record-stable-id branch March 21, 2024 19:35
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

Successfully merging this pull request may close these issues.

None yet

3 participants