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

Improve DDL management for custom functions #17

Closed
wants to merge 1 commit into from

Conversation

jessemyers
Copy link
Contributor

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)

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
Copy link
Contributor Author

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

Copy link
Contributor

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?

Copy link
Contributor

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`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Event hooks!

Copy link
Contributor

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):
Copy link
Contributor Author

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.

@jessemyers jessemyers closed this Mar 2, 2018
@jessemyers jessemyers deleted the feature/better-ddl-management branch March 2, 2018 01:19
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

2 participants