-
Notifications
You must be signed in to change notification settings - Fork 26
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
Use Snowflake IDs for nodes and edges #202
Conversation
This is now fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hold until #174 is merged.
bw2data/backends/schema.py
Outdated
class SnowflakeIDBaseClass(Model): | ||
id = IntegerField(primary_key=True) | ||
|
||
def save(self, **kwargs): | ||
if self.id is None: | ||
# If the primary key column data is already present (even if the object doesn't exist in | ||
# the database), peewee will make an `UPDATE` query. This will have no effect if there | ||
# isn't a matching row. Need for force an `INSERT` query instead as we generate the ids | ||
# ourselves. | ||
# https://docs.peewee-orm.com/en/latest/peewee/models.html#id4 | ||
self.id = next(snowflake_id_generator) | ||
kwargs['force_insert'] = True | ||
super().save(**kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also conflicting with #174; will need to be rebased after that one is merged. We can then make SignaledDataset
inherit from this one and up goes the super.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can then make SignaledDataset
exatamente
After #174 is merged:
|
This will go away as we will explicitly map functions instead of using string interpolation, see more-event-types branch. |
Update compatibility.py Remove debugging print statements Clarify some comments Improve error message Cleanup error messages Co-Authored-By: João Gonçalves <[email protected]>
Use Snowflake IDs for nodes and edges
Use Snowflake IDs for nodes and edges
Needed for distributed object creation without conflicting id values.