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

Grant user privileges #3326

Closed
sqlalchemy-bot opened this issue Mar 16, 2015 · 4 comments
Closed

Grant user privileges #3326

sqlalchemy-bot opened this issue Mar 16, 2015 · 4 comments
Labels
bug Something isn't working

Comments

@sqlalchemy-bot
Copy link
Collaborator

Migrated issue, originally created by Leonardo Rossi (@hachreak)

Exists the possibility to use SQLAlchemy to create user and grant privilege on the DB?

@sqlalchemy-bot
Copy link
Collaborator Author

Michael Bayer (@zzzeek) wrote:

absolutely. Easiest is to emit the desired GRANT statements using statement execution:

engine = create_engine(...)
engine.execute("GRANT ALL PRIVILEGES ON *.* TO moonbeam")

if you want automatic GRANTs which can also be conditional based on backends, see the DDL system.

@sqlalchemy-bot
Copy link
Collaborator Author

Changes by Michael Bayer (@zzzeek):

  • changed status to closed

@sqlalchemy-bot
Copy link
Collaborator Author

Leonardo Rossi (@hachreak) wrote:

it's independent by the db server? :)

@sqlalchemy-bot
Copy link
Collaborator Author

Michael Bayer (@zzzeek) wrote:

no. the differences in GRANT across databases are dramatically different not just in syntax but in semantics. For example, if you did a PG GRANT for a username, that won't work at all on MySQL - you need a hostname on MySQL as well. it's entirely not worth it at all to build such an API, it would be extremely complex and nobody would be using it, as it's more about configuration of the database itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant