The first post was meant to be a draft and posted by mistake. Here is, 
hopefully, a clearer post.


I’m new to Pyramid. I’ve used Python for a few months. I created a Python 
application on Linux to maintain an Oracle database using weekly data feeds 
from a vendor. To get that done, one of the things I did was to create a 
customized database wrapper class using cx_Oracle. I had specific 
requirements for maintaining history in the DB. All Oracle access goes 
through the methods in this wrapper.  I now want to use Pyramid to create a 
simple reporting browser interface to the Oracle DB. To allow me the 
greatest flexibility, I’d like to use the wrapper I already have to get to 
the data on Oracle instead of Alchemy (or possibly with it, I don’t know).

I’ve considered importing my wrapper in my views.py __init__ method but 
that seems to get executed with every browser submit. Can anyone suggest 
how I might create a persistent connection to Oracle that I can use over 
and over from my reporting application which uses my wrapper class? I’m 
finding Pyramid a bit opaque. I’m never sure what’s happening behind the 
scenes but I’m willing to operate on trust until I get the swing of it. I 
need the benefit of the automatic authorization/ authentication, session 
mgt and login.

What I’m really looking for here is a good approach from experienced 
Pyramid users before going down the wrong track.

On Monday, July 11, 2016 at 12:43:41 PM UTC-4, Niall wrote:
>
> I'm trying to use Pyramid to create a simple reporting web interface to an 
> existing Oracle database. 
> In creating/maintaining this database, I created a wrapper in the form of 
> a python class, which has all the methods I need to put data into the db 
> and query the data. I've standardized on Python dictionaries for all result 
> sets and would like to keep it that way for the web interface.
>
> I now want to use this db wrapper class to get to the database from the 
> Pyramid app. I would like the class to persist while the web app runs. I've 
> considered accessing the wrapper from my __init__.py program but I'm 
> unclear how my views.py class methods will be able to access it then. I 
> considered instantiating the wrapper class in the __init__ method of my 
> views.py program but noticed that each browser submit causes a new db 
> connection. I'd like to use the same connection, or connection pooling.
>
> Could someone kindly advise on a correct approach. I'm relatively new to 
> Pyramid and started using Python about a year back for batch business 
> processing.
>
> Many thanks folks.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/34adea25-2035-4020-bacf-d11cd80d8315%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to