Hi,

I am not sure if this topic should better be in the sqlalchemy group but as 
it is directly related to the way pyramid web applications are driven  
often I ended up posting here.

I have a webapplication using sqlalchemy and ORM with one single connection 
(or better a connection pool) to the database. The credentials to connect 
to the database are set in the ini file. The session is build and the 
application uses it to talk to the database.
Nothing unusual yet. I think this is how many web application setup the db 
connection.

My goal is to replace this central db connection (with credentials held as 
plaintext in the ini file) with a per request connection with credetials 
provided by the user during the login process in the webapplication. I know 
that this comes with performance issues as the connection will be 
established and closed on every request. 

Example:
Bob calls the login page of the webapplication and provides his username 
and password. This username and password will be used to initiate a 
connection for this user. If a connection can be established the username 
and password can be saved in the session and reused for later connections 
again.

I think/hope basically this should be possible in some way. But how? At 
least I know that i can rebind the connection of the sqlalchemy session. So 
i can initiate a new connection for the current request and bind it to the 
session. But I expect problems here with concurrent requests.
So maybe having a session per user might be worth looking closer at.

Does anyone have experience in this?

Torsten

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-discuss+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-discuss@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to