[web2py] Re: Database access without DAL but with connection pool
Derek, the conventional wisdom is connecting to a db is expensive. I'm willing to be convinced, but I need some data. Can you point me to some? Because if your statement is true, we could eliminate some pretty hairy code in the DAL to support pooling. On Wednesday, March 19, 2014 7:44:10 PM UTC-4, Derek wrote: I'd say the answer to 2 is 'not really'. Believe it or not, opening and dropping database connections is a fast operation. On Tuesday, March 18, 2014 11:33:04 PM UTC-7, tec...@gmail.com wrote: Dear Sirs, I understand it's possible to use databases without DAL. For example function in controller: def values(): client = pymongo.MongoClient('localhost', 27017) db = client.mybase mytable = db[mytable] res = mytable.find() . return dict() And of course it works. But is it fast to connect/disconnect every time in function? What's about connection pool? I consider connection pool could increase access to database. 1. Actually I would like to ask how to access to database without DAL but at maximum speed? 2. Do I need connection pool for fast database access? (I think, yes.) 3. How could I build custom connection pool for database access without DAL? Or any solution to re-use connections to database server? Any examples? Andrey A. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Database access without DAL but with connection pool
I can't point you to any, you are welcome to do tests yourself. (note: this is why i said believe it or not) On Thursday, March 20, 2014 6:22:20 AM UTC-7, Cliff Kachinske wrote: Derek, the conventional wisdom is connecting to a db is expensive. I'm willing to be convinced, but I need some data. Can you point me to some? Because if your statement is true, we could eliminate some pretty hairy code in the DAL to support pooling. On Wednesday, March 19, 2014 7:44:10 PM UTC-4, Derek wrote: I'd say the answer to 2 is 'not really'. Believe it or not, opening and dropping database connections is a fast operation. On Tuesday, March 18, 2014 11:33:04 PM UTC-7, tec...@gmail.com wrote: Dear Sirs, I understand it's possible to use databases without DAL. For example function in controller: def values(): client = pymongo.MongoClient('localhost', 27017) db = client.mybase mytable = db[mytable] res = mytable.find() . return dict() And of course it works. But is it fast to connect/disconnect every time in function? What's about connection pool? I consider connection pool could increase access to database. 1. Actually I would like to ask how to access to database without DAL but at maximum speed? 2. Do I need connection pool for fast database access? (I think, yes.) 3. How could I build custom connection pool for database access without DAL? Or any solution to re-use connections to database server? Any examples? Andrey A. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Database access without DAL but with connection pool
I am not sure about pymongo but if you use DAL('mongodb:') the dal will do pooling for you. On Wednesday, 19 March 2014 01:33:04 UTC-5, tec...@gmail.com wrote: Dear Sirs, I understand it's possible to use databases without DAL. For example function in controller: def values(): client = pymongo.MongoClient('localhost', 27017) db = client.mybase mytable = db[mytable] res = mytable.find() . return dict() And of course it works. But is it fast to connect/disconnect every time in function? What's about connection pool? I consider connection pool could increase access to database. 1. Actually I would like to ask how to access to database without DAL but at maximum speed? 2. Do I need connection pool for fast database access? (I think, yes.) 3. How could I build custom connection pool for database access without DAL? Or any solution to re-use connections to database server? Any examples? Andrey A. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Database access without DAL but with connection pool
Hello Massimo, Thank you for reply. On Wednesday, March 19, 2014 7:20:27 PM UTC+5, Massimo Di Pierro wrote: I am not sure about pymongo but if you use DAL('mongodb:') the dal will do pooling for you. Ok, I will check this. Actually I don't want to use pymongo only, it could any database which DAL doesn't support. As I wrote before I think it's not good idea to connect (disconnect) to database in controller function. Could you (anybody) provide example of custom connection pool? Just checked web2py resources, no any single example? Andrey A. On Wednesday, 19 March 2014 01:33:04 UTC-5, tec...@gmail.com wrote: Dear Sirs, I understand it's possible to use databases without DAL. For example function in controller: def values(): client = pymongo.MongoClient('localhost', 27017) db = client.mybase mytable = db[mytable] res = mytable.find() . return dict() And of course it works. But is it fast to connect/disconnect every time in function? What's about connection pool? I consider connection pool could increase access to database. 1. Actually I would like to ask how to access to database without DAL but at maximum speed? 2. Do I need connection pool for fast database access? (I think, yes.) 3. How could I build custom connection pool for database access without DAL? Or any solution to re-use connections to database server? Any examples? Andrey A. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Database access without DAL but with connection pool
Well, if you want to do it without the DAL, there are several options that might just work without any additional code: - check if specific python libs that you'll use for the db connection already provide a similar pooling function, they might - check if the database backend natively provides such a function. If neither is applicable... I suggest extending the DAL to support a new database ;) Regards On Wednesday, March 19, 2014 3:49:39 PM UTC+1, tec...@gmail.com wrote: Hello Massimo, Thank you for reply. On Wednesday, March 19, 2014 7:20:27 PM UTC+5, Massimo Di Pierro wrote: I am not sure about pymongo but if you use DAL('mongodb:') the dal will do pooling for you. Ok, I will check this. Actually I don't want to use pymongo only, it could any database which DAL doesn't support. As I wrote before I think it's not good idea to connect (disconnect) to database in controller function. Could you (anybody) provide example of custom connection pool? Just checked web2py resources, no any single example? Andrey A. On Wednesday, 19 March 2014 01:33:04 UTC-5, tec...@gmail.com wrote: Dear Sirs, I understand it's possible to use databases without DAL. For example function in controller: def values(): client = pymongo.MongoClient('localhost', 27017) db = client.mybase mytable = db[mytable] res = mytable.find() . return dict() And of course it works. But is it fast to connect/disconnect every time in function? What's about connection pool? I consider connection pool could increase access to database. 1. Actually I would like to ask how to access to database without DAL but at maximum speed? 2. Do I need connection pool for fast database access? (I think, yes.) 3. How could I build custom connection pool for database access without DAL? Or any solution to re-use connections to database server? Any examples? Andrey A. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Database access without DAL but with connection pool
I'd say the answer to 2 is 'not really'. Believe it or not, opening and dropping database connections is a fast operation. On Tuesday, March 18, 2014 11:33:04 PM UTC-7, tec...@gmail.com wrote: Dear Sirs, I understand it's possible to use databases without DAL. For example function in controller: def values(): client = pymongo.MongoClient('localhost', 27017) db = client.mybase mytable = db[mytable] res = mytable.find() . return dict() And of course it works. But is it fast to connect/disconnect every time in function? What's about connection pool? I consider connection pool could increase access to database. 1. Actually I would like to ask how to access to database without DAL but at maximum speed? 2. Do I need connection pool for fast database access? (I think, yes.) 3. How could I build custom connection pool for database access without DAL? Or any solution to re-use connections to database server? Any examples? Andrey A. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.