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

[typing] prefect.server.utilities.database #16362

Closed
wants to merge 2 commits into from

Conversation

mjpieters
Copy link
Contributor

This is a complete refactor of this module.

  • Move functions into the sqlalchemy.func namespace so they don't need to be imported everywhere
  • Re-use SQLAlchemy's Postgresql JSONB operators by providing SQLite equivalents
  • Provide a new function that calculates the difference between timestamps as seconds.

This removes the need for many separate PostgreSQL vs SQLite queries.

Related to #16292

@github-actions github-actions bot added the development Tech debt, refactors, CI, tests, and other related work. label Dec 12, 2024
This is a complete refactor of this module.

- Move functions into the `sqlalchemy.func` namespace so they don't need to be imported everywhere
- Re-use SQLAlchemy's Postgresql JSONB operators by providing SQLite equivalents
- Provide a new function that calculates the difference between timestamps as seconds.

This removes the need for many separate PostgreSQL vs SQLite queries.
@zzstoatzz
Copy link
Collaborator

zzstoatzz commented Dec 12, 2024

👋 hi @mjpieters - in keeping with #16356, can we use prefect.types.DateTime instead of pendulum.DateTime? I appeared to have missed a couple import pendulum; pendulum.DateTime uses

@mjpieters
Copy link
Contributor Author

👋 hi @mjpieters - in keeping with #16356, can we use prefect.types.DateTime instead of pendulum.DateTime? I appeared to have missed a couple import pendulum; pendulum.DateTime uses

I don't think you missed any; I think there is a mix-up here between pydantic_extra_types.pendulum_dt and pendulum? There are references to pendulum all over prefect still and you can't just replace the pendulum.now() and pendulum.timezone() calls with the two annotated types in prefect.types, I don't think.

@mjpieters
Copy link
Contributor Author

I'm closing this PR to re-open a new one, as I accidentally pushed my commits to my fork main branch.

@mjpieters mjpieters closed this Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Tech debt, refactors, CI, tests, and other related work.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants