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

[doc] Please provide information about using database #376

Open
ghost opened this issue Sep 16, 2016 · 6 comments
Open

[doc] Please provide information about using database #376

ghost opened this issue Sep 16, 2016 · 6 comments
Labels

Comments

@ghost
Copy link

ghost commented Sep 16, 2016

Can you please add information in the docs about how to use a database using for example SQLAlchemy or database raw?

Thanks

@bernhardreiter
Copy link
Contributor

I'm especially interested in setup, pooling and teardown of a database connection. My prefered example would be postgresql via psycopg2.

@robsonpeixoto
Copy link

It's very important.

@bernhardreiter
Copy link
Contributor

bernhardreiter commented Feb 20, 2017

For what it is worth: I am using a global variable for my "raw" database connection with hug in

  1. https://github.com/Intevation/intelmq-mailgen/blob/master/extras/checkticket-spa/checkticket.py
  2. https://github.com/Intevation/intelmq-mailgen/tree/master/extras/contactdb_api

Both uses are still "experimental" and there are a number of drawbacks for using global variables,
one is that I don't know how scaling to different tasks or processes will be handled. My use case for the two examples so far is okay with just a single hug running.

Note that #405 (hug.startup() is not called for cli applications).

A good path forward would be to see how other falcon applications handle such resources that would need to be kept once per serving instance/task or once per process.

@FFX01
Copy link

FFX01 commented Jun 17, 2017

Would anyone be interested in a tutorial on how to set up Hug with mongodb, Marshmallow, and pymongo?

@bernhardreiter
Copy link
Contributor

@FFX01 more examples are always good I believe, so thanks for offering to write a tutorial. Personally I have already outlined above what interests me most. (How to keep a resource like a psycopg2.pool
object between several threads.)

@FFX01
Copy link

FFX01 commented Jun 19, 2017

@bernhardreiter

Unfortunately, I do not have a solution for that use case. I don't know all that much about the psycopg2 internals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants