[web2py] Re: Is anyone using MongoDB with web2py?

2010-05-09 Thread David Marko
Thank you for your response. I still have the problem with the
connection object to MongoDB as stated in my first post. Where to put
the lines establishing the connection?

-
If I put the code below into db.py, each request causes the new
connection opened to MongoDB what mean that after 500 requests to my
app, there are 500 separate connections I can see on MongoDB console.

 from pymongo import Connection
 connection = Connection()

Where to put the connection code to have some pooling mechanism so
connection is shared among requests?
-

David

On 9 kvě, 05:43, Yarko Tymciurak resultsinsoftw...@gmail.com wrote:
 On May 8, 12:40 pm, David Marko dma...@tiscali.cz wrote:

  Yes, I know, but you should be able to use it without DAL using
  pymongo as a primary MongoDB python driver. And thats where my
  question goes.

 If you want to experiement, and get a start, I suggest you write your
 scaffolding app without / with minimal data, and see if you can live
 with just using FORM, and managing your own validation.  That would be
 a first step.

 Then, - if you kept your scaffolding data really basic,  it should be
 easy to shift to pyMongo - your queries are going to be quite
 different so that is probably the next piece of work you will have: to
 manage how you make reasonably compact queries that work, and look
 familiar.

 Next, I imagine you will tackle managing the validation on those
 queries, and tying that into your forms.

 By then, you might as well adapt things that look like the SQLFORMS,
 possibly borrowing, rewriting them

 Of course, this will all be much easier once someone has blazed this
 trail, and you will have at least a head start on a NoDAL environment.

 As long as you take it in small steps, you will at least see what
 you're in for.

 Let us know how your excursions go!

 Regards,
 - Yarko





  David

  On 8 kvě, 19:22, Pystar aitoehi...@gmail.com wrote:

   For now, Web2py's DAL doesnt support NoSQL databases. I think Massimo
   can tell us more on the status of the DAL rewrite and when it would be
   possible.

   On May 8, 5:59 pm, David Marko dma...@tiscali.cz wrote:

Is anyone using MongoDB with web2py? How do you 'share' connection
object in your app when using pymongo?

If I put the code below into db.py, each request causes the new
connection opened to MongoDB what mean that after 500 requests to my
app, there are 500 separate connections I can see on MongoDB console.

 from pymongo import Connection
 connection = Connection()

Where to put the connection code to have some pooling mechanism so
connection is shared among requests?

David


[web2py] Re: Is anyone using MongoDB with web2py?

2010-05-09 Thread rfx_labs
Hi David,

I think the problem is that modules and controllers are executed on
every page call.

The web2py DAL open AND close a new connection to the DB on ever page
call. Maybe you shut do the same for mongo too.
 connection = Connection()
do your stuff
 connection.disconnect()

Martin


On 9 Mai, 08:22, David Marko dma...@tiscali.cz wrote:
 Thank you for your response. I still have the problem with the
 connection object to MongoDB as stated in my first post. Where to put
 the lines establishing the connection?


[web2py] Re: Is anyone using MongoDB with web2py?

2010-05-09 Thread David Marko
And where is the good pace to make such call? Has web2py some place
which is guarantied to be called after response has been sent to
browser?

David

On 9 kvě, 13:14, rfx_labs l...@reproflex.de wrote:
 Hi David,

 I think the problem is that modules and controllers are executed on
 every page call.

 The web2py DAL open AND close a new connection to the DB on ever page
 call. Maybe you shut do the same for mongo too.

  connection = Connection()
 do your stuff
  connection.disconnect()

 Martin

 On 9 Mai, 08:22, David Marko dma...@tiscali.cz wrote:



  Thank you for your response. I still have the problem with the
  connection object to MongoDB as stated in my first post. Where to put
  the lines establishing the connection?


[web2py] Re: Is anyone using MongoDB with web2py?

2010-05-08 Thread Pystar
For now, Web2py's DAL doesnt support NoSQL databases. I think Massimo
can tell us more on the status of the DAL rewrite and when it would be
possible.

On May 8, 5:59 pm, David Marko dma...@tiscali.cz wrote:
 Is anyone using MongoDB with web2py? How do you 'share' connection
 object in your app when using pymongo?

 If I put the code below into db.py, each request causes the new
 connection opened to MongoDB what mean that after 500 requests to my
 app, there are 500 separate connections I can see on MongoDB console.

  from pymongo import Connection
  connection = Connection()

 Where to put the connection code to have some pooling mechanism so
 connection is shared among requests?

 David


[web2py] Re: Is anyone using MongoDB with web2py?

2010-05-08 Thread David Marko
Yes, I know, but you should be able to use it without DAL using
pymongo as a primary MongoDB python driver. And thats where my
question goes.

David

On 8 kvě, 19:22, Pystar aitoehi...@gmail.com wrote:
 For now, Web2py's DAL doesnt support NoSQL databases. I think Massimo
 can tell us more on the status of the DAL rewrite and when it would be
 possible.

 On May 8, 5:59 pm, David Marko dma...@tiscali.cz wrote:



  Is anyone using MongoDB with web2py? How do you 'share' connection
  object in your app when using pymongo?

  If I put the code below into db.py, each request causes the new
  connection opened to MongoDB what mean that after 500 requests to my
  app, there are 500 separate connections I can see on MongoDB console.

   from pymongo import Connection
   connection = Connection()

  Where to put the connection code to have some pooling mechanism so
  connection is shared among requests?

  David


[web2py] Re: Is anyone using MongoDB with web2py?

2010-05-08 Thread Yarko Tymciurak
On May 8, 12:40 pm, David Marko dma...@tiscali.cz wrote:
 Yes, I know, but you should be able to use it without DAL using
 pymongo as a primary MongoDB python driver. And thats where my
 question goes.

If you want to experiement, and get a start, I suggest you write your
scaffolding app without / with minimal data, and see if you can live
with just using FORM, and managing your own validation.  That would be
a first step.

Then, - if you kept your scaffolding data really basic,  it should be
easy to shift to pyMongo - your queries are going to be quite
different so that is probably the next piece of work you will have: to
manage how you make reasonably compact queries that work, and look
familiar.

Next, I imagine you will tackle managing the validation on those
queries, and tying that into your forms.

By then, you might as well adapt things that look like the SQLFORMS,
possibly borrowing, rewriting them

Of course, this will all be much easier once someone has blazed this
trail, and you will have at least a head start on a NoDAL environment.

As long as you take it in small steps, you will at least see what
you're in for.

Let us know how your excursions go!

Regards,
- Yarko

 David

 On 8 kvě, 19:22, Pystar aitoehi...@gmail.com wrote:

  For now, Web2py's DAL doesnt support NoSQL databases. I think Massimo
  can tell us more on the status of the DAL rewrite and when it would be
  possible.

  On May 8, 5:59 pm, David Marko dma...@tiscali.cz wrote:

   Is anyone using MongoDB with web2py? How do you 'share' connection
   object in your app when using pymongo?

   If I put the code below into db.py, each request causes the new
   connection opened to MongoDB what mean that after 500 requests to my
   app, there are 500 separate connections I can see on MongoDB console.

from pymongo import Connection
connection = Connection()

   Where to put the connection code to have some pooling mechanism so
   connection is shared among requests?

   David