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

How to use multiple DB users? #701

Open
sscots opened this issue Oct 21, 2020 · 0 comments
Open

How to use multiple DB users? #701

sscots opened this issue Oct 21, 2020 · 0 comments

Comments

@sscots
Copy link

sscots commented Oct 21, 2020

In my flask restless file, I have a read user and a write user. Each has their own db session.
This is basically what I'm trying to do at the moment:

manager = flask_restless.APIManager(app, session=read_session)

server = manager.create_api(Server, methods=["GET"])

admin_manager = flask_restless.APIManager(app, session=write_session)

server_admin = admin_manager.create_api(Server, collection_name='server_admin', methods=["GET","POST","PUT","PATCH","DELETE"])

but am getting an error that says:
"Flask-Restless has already been initialized on this application"

I also tried this and it doesn't seem to work either

manager = flask_restless.APIManager(app, session=read_session)

server = manager.create_api(Server, methods=["GET"])

manager.session = write_session

server_admin = manager.create_api(Server, collection_name='server_admin', methods=["GET","POST","PUT","PATCH","DELETE"])

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

1 participant