Ticket #748 (defect)
Opened 9 months ago
Last modified 2 weeks ago
PostgresqlSession is incomplete, broken, and too specific
Status: new
| Reported by: | fumanchu | Assigned to: | rdelon |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.2 |
| Component: | sessions | Keywords: | |
| Cc: |
The current PostgresqlSession class:
- Is incomplete without a get_db function. At the least, it should try to import pypgsql and psycopg.
- Is broken, since it doesn't even INSERT new rows.
- Is too specific. It should be transformed into a generic DBAPISession class (which would make it incomplete again, but why limit ourselves to a single provider for such a simple need?).
Change History
03/19/08 23:13:44: Modified by guest
07/09/08 03:12:31: Modified by nick125
I'm not particularly sure what a DBSession class would provide, especially if you are talking about allowing ORMs.
As for the entire get_db() function, I'm not sure how else you could implement it, as I think adding database initialization code would be too complex and inflexible. Maybe you could allow the database object/cursor to be passed to the initializer, although I'm not too sure on the implementation specifics.
I think that PostgresqlSession? should either be scrapped or replaced with a much more generic implementation, like fumanchu said in the initial report. It would be hard to do a generic implementation, especially with varying schemas. We could allow the users to specify the query strings and pass an already initialized database cursor, which would solve some of the issues.


1) There should be a way to specify the postgresql schema. Current implementation assumes that table will be created in default public schema.
2) I think we should create a generic DBSession class and then derive PGSession class from DBSession class. This will allow us to plugin other databases in future. Why limit to postgresql for db session storage ?
3) DBSession class (if created) should be able to use ORMs (which people use even to our dismay).
---
Vivek Khurana