-
Notifications
You must be signed in to change notification settings - Fork 2
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
Improve DDL management for custom functions #17
Conversation
Changes: - DDL is not activated via sqlalchemy events; this ensures that unit tests work - DDL is not exposed via a `create(connection)` or `drop(connection)` method; Downstream projects will have to generate their own migrations. - Small API change from `last.over_(foo)` to `last.of(foo)`
@@ -0,0 +1 @@ | |||
recursive-include microcosm_eventsource *.ddl |
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.
DDL files are now included as text in the dist
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.
How are these expected to be accessed?
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.
Ah, I see the resource_string call below.
return resource_string("microcosm_eventsource", f"ddl/{name}.{action}.ddl").decode("utf-8") | ||
|
||
|
||
# register custom DDL when calling `create_all` or `drop_all` |
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.
Event hooks!
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.
Neat.
event = column.class_ | ||
return cls(column).over( | ||
order_by=event.clock.asc(), | ||
partition_by=event.container_id, | ||
) | ||
|
||
@staticmethod | ||
def create(connection): |
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.
Downstream services will have to write these statements themselves.
Changes:
DDL is not activated via sqlalchemy events; this ensures that unit tests work
DDL is not exposed via a
create(connection)
ordrop(connection)
method;Downstream projects will have to generate their own migrations.
Small API change from
last.over_(foo)
tolast.of(foo)