Skip to content

Make cargo sqlx prepare cache whole db structure, instead of individual queries #632

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

Closed
AdrianEddy opened this issue Aug 14, 2020 · 1 comment

Comments

@AdrianEddy
Copy link

If possible, it will be useful to add a way to prepare/cache the whole database structure (all tables/columns), instead of only used queries. This would allow to have the database mapped once and continue with development without the need to update cached file after each new/changed query in code.

This can be added as additional parameter, for example cargo sqlx prepare full

@abonander
Copy link
Collaborator

Caching the schema would not be useful to the macros as they do not analyze SQL themselves; it's necessary to pass the SQL to the database engine for parsing and analysis. If we wanted to analyze the SQL ourselves we would essentially be reimplementing a good chunk of the server frontend for every database flavor we intend to support (since each has a different feature set and different subsets of the SQL standard it supports). Not exactly trivial.

There's discussion about making query data caching more automatic in #570. Otherwise, I'm closing this issue as not currently actionable.

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

No branches or pull requests

2 participants