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

Connection with dynamic backend based on connection string #1881

Closed
guangie88 opened this Issue Oct 12, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@guangie88

guangie88 commented Oct 12, 2018

Are there any plans to support Connection that can switch to any of the supported database connections at runtime? Might look something like the following in Python SQLAlchemy. Connection trait object doesn't work due to trait object safety.

It would be useful for code that can dynamically change the connection backend based on the connection string.

@weiznich

This comment has been minimized.

Contributor

weiznich commented Oct 12, 2018

That's more or less out of scope for diesel, because diesel depends on compile time on knowing what database is used and then generates the corresponding sql specific to that database.
Also it will prevent using unsupported sql features at compile time. (For example you could only use Unsigned<Integer> using the MySql backend. For all other connections/backends this results in a compiler error. Adding a generic connection type would result in one of the two following strategies:

  • Support only a common subset of sql that is supported on all backends (if that even exists and if it's usefull)
  • Possibility to generate sql that is invalid (We should not do that, in my opinion.)

(Closed because this is nothing directly actionable for the diesel team. Use our discourse forum for feature requests.)

@weiznich weiznich closed this Oct 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment