-
Notifications
You must be signed in to change notification settings - Fork 162
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
Special behavior invocation via comment instead of a custom SQL #168
Comments
Refers to: #165 |
Agreed! One small issue I ran into so far is ORMs, e.g. ActiveRecord, will start a transaction automatically if you create/save a model, but it won't put the comment into the For others, e.g. Django, this is not an issue because transactions are not started automatically. Any ideas are welcome! We will probably just modify ActiveRecord on our side and run with the comment approach, but we'd like to make this easy to use for everyone. @ankurcha , what ORM, if any, are you using for your apps? |
I am using golang without any ORM. For ORMs like activerecord we would likely need to do some monkey patching to prepend the sql. In my experience, adding comments to annotate sql is probably going to be difficult to consistently added without some custom implementation for each one. You could also think about wrapping the sql driver for each supported language. |
wondering how to use shard comment in sqlalchemy transaction |
Just adding my voice to the chorus here: implementing this would make transitioning to pgcat from pgpool-II substantially simpler. PGPool uses comments to allow clients to pick whether they will be normally load-balanced or sent directly to the primary instance: https://www.pgpool.net/docs/42/en/html/runtime-config-load-balancing.html -- adding another comment on top of that one is trivial, but using a sql-ish statement that can only be parsed by pgcat makes the cutover process a lot trickier. |
Is your feature request related to a problem? Please describe.
The custom SQL introduced for selecting shard and replicas is functional but it makes transition to a sharded environment and testing less transparent. It would be better if we could follow https://github.com/ossc-db/pg_hint_plan kind of approach where the
SET SHARDING KEY TO ...
andSET SERVER ROLE TO '(PRIMARY|REPLICA|ANY|AUTO|DEFAULT)'
is into comments like:to set the right behaior.
Describe the solution you'd like
Use comment based way of enabling shard / replica selection.
Describe alternatives you've considered
separate pools and application logic.
Additional context
The text was updated successfully, but these errors were encountered: