Re: [web2py] Re: New Dal causing a problem

2012-05-07 Thread Johann Spies
Thanks.

Johann


-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)


Re: [web2py] Re: new dal

2010-12-09 Thread Mariano Reingart
There seems to be a problem with options widget and new dal:

http://code.google.com/p/web2py/issues/detail?id=136

Widget seems to be generating string fields (i.e. 'tipo_cbte.desc,
tipo_cbte.cod'), and dal is specting Expressions.

Best regards,

Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com


Re: [web2py] Re: new dal

2010-12-07 Thread G. Clifford Williams
Is VoltDB supported?

Sent from some mobile device

On Dec 7, 2010, at 2:09 PM, Bruno Rocha  wrote:

> MongoHQ can be useful for testing, they offer a free limited instance
> 
> https://mongohq.com/pricing
> 
> 
> 
> 2010/12/7 mdipierro 
> I run some benchmarks. The time to do insert and select is the same.
> The difference it no measurable because dominated by db IO. Anyway the
> code is below and the output is:
> 
> old dal:
> 7.98740386963e-05 (sec)
> 0.00134269499779
> 
> new dal:
> 8.04572105408e-05
> 0.00139242005348
> 
> Notice all the time is in the IO. The time to actually parse the
> complex query is negligible.
> 
> 
> code:
> import os
> os.system('rm *.sqlite test* *.table sql.log')
> 
> #from dal import
> *
> from sql_old import *
> db=DAL('sqlite://test.sqlite')
> db.define_table('person',Field('name'))
> db(db.person).delete()
> db.commit()
> 
> import time
> 
> def t(f,n=1000):
>t0=time.time()
>for i in range(n): f()
>return (time.time()-t0)/n
> 
> def a():
>db.person.insert(name='max')
> def b():
>db((db.person.name=='max')&(db.person.name.like('max
> %'))&(db.person.name.startswith('m'))).select(limitby=(0,20))
> 
> print t(a)
> print t(b)
> 
> 
> 
> 
> -- 
> 
> Bruno Rocha
> http://about.me/rochacbruno/bio


Re: [web2py] Re: new dal

2010-12-07 Thread Bruno Rocha
MongoHQ can be useful for testing, they offer a free limited instance

https://mongohq.com/pricing



2010/12/7 mdipierro 

> I run some benchmarks. The time to do insert and select is the same.
> The difference it no measurable because dominated by db IO. Anyway the
> code is below and the output is:
>
> old dal:
> 7.98740386963e-05 (sec)
> 0.00134269499779
>
> new dal:
> 8.04572105408e-05
> 0.00139242005348
>
> Notice all the time is in the IO. The time to actually parse the
> complex query is negligible.
>
>
> code:
> import os
> os.system('rm *.sqlite test* *.table sql.log')
>
> #from dal import
> *
> from sql_old import *
> db=DAL('sqlite://test.sqlite')
> db.define_table('person',Field('name'))
> db(db.person).delete()
> db.commit()
>
> import time
>
> def t(f,n=1000):
>t0=time.time()
>for i in range(n): f()
>return (time.time()-t0)/n
>
> def a():
>db.person.insert(name='max')
> def b():
>db((db.person.name=='max')&(db.person.name.like('max
> %'))&(db.person.name.startswith('m'))).select(limitby=(0,20))
>
> print t(a)
> print t(b)
>
>


-- 

Bruno Rocha
http://about.me/rochacbruno/bio


Re: [web2py] Re: new dal

2010-12-06 Thread G. Clifford Williams
You got it.

BTW, anyone else interested in ZODB support? It's not the new fangled toy that 
these NoSQL databases are but it's still awesome. 

--G. Clifford Williams
Sent from some mobile device

On Dec 7, 2010, at 12:23 AM, mdipierro  wrote:

> I got CouchDB working. Denes is working on MongoDB. I think we are
> setup for December. In January, you could provide a Cassandra
> server. ;-)
> 
> massimo
> 
> On Dec 7, 12:19 am, "G. Clifford Williams" 
> wrote:
>> I can donate a couple of FreeBSD jails with various databases setup if you 
>> let me know what you want.
>> 
>> --G. Clifford Williams
>> Sent from some mobile device
>> 
>> On Dec 6, 2010, at 4:38 PM, mdipierro  wrote:
>> 
>>> With the new DAL it should take very little to create a DAL interface
>>> to mongodb, couchdb, etc.
>> 
>>> I can work on this if
>>> - you help me prioritize
>>> - you can give me access to a machine that already has your favorite
>>> nosql db installed ready for testing
>> 
>>> Massimo
>> 
>>> On Dec 6, 3:10 pm, Jonathan Lundell  wrote:
 On Dec 6, 2010, at 12:55 PM, mdipierro wrote:
>> 
> 1) The new DAL (dal.py) passes all the tests I have.
> 2) The new DAL has integrated GAE support (datastore) without need for
> contrib/gql.py
> 3) The new DAL is better because more customizable, smaller (10%), and
> more readable
> 4) The new DAL is one single file and it does not depend on web2py.
>> 
 Have you decided to keep it as a single file, or break it into a package?
>> 
>> 


Re: [web2py] Re: new dal

2010-12-06 Thread G. Clifford Williams
I can donate a couple of FreeBSD jails with various databases setup if you let 
me know what you want.

--G. Clifford Williams
Sent from some mobile device

On Dec 6, 2010, at 4:38 PM, mdipierro  wrote:

> With the new DAL it should take very little to create a DAL interface
> to mongodb, couchdb, etc.
> 
> I can work on this if
> - you help me prioritize
> - you can give me access to a machine that already has your favorite
> nosql db installed ready for testing
> 
> Massimo
> 
> 
> On Dec 6, 3:10 pm, Jonathan Lundell  wrote:
>> On Dec 6, 2010, at 12:55 PM, mdipierro wrote:
>> 
>> 
>> 
>>> 1) The new DAL (dal.py) passes all the tests I have.
>>> 2) The new DAL has integrated GAE support (datastore) without need for
>>> contrib/gql.py
>>> 3) The new DAL is better because more customizable, smaller (10%), and
>>> more readable
>>> 4) The new DAL is one single file and it does not depend on web2py.
>> 
>> Have you decided to keep it as a single file, or break it into a package?


Re: [web2py] Re: new dal

2010-12-06 Thread Vasile Ermicioi
I propose to include a copy in site-packages and distribute it with web2py,
so no installation will be required, it is quite small  < 100kb


Re: [web2py] Re: new dal

2010-12-06 Thread Vasile Ermicioi
I am testing new dal (alone, without web2py) and also tested one old idea -
I use pymysql instead of MySQLdb, and it works fine with python (2.7) and
jython (2.5rc2)

why not integrating it on web2py, I think that makes web2py what it claims
to be "requires no installation"
also it seems to have a good performance
http://code.google.com/p/pymysql/wiki/Performance

just replace 2 lines:

import MySQLdb
with
import pymysql

and

charset=charset: MySQLdb.Connection(db=db,
with
charset=charset: pymysql.connect(db=db,


Re: [web2py] Re: new dal

2010-12-06 Thread Jonathan Lundell
On Dec 6, 2010, at 12:55 PM, mdipierro wrote:
> 
> 1) The new DAL (dal.py) passes all the tests I have.
> 2) The new DAL has integrated GAE support (datastore) without need for
> contrib/gql.py
> 3) The new DAL is better because more customizable, smaller (10%), and
> more readable
> 4) The new DAL is one single file and it does not depend on web2py.

Have you decided to keep it as a single file, or break it into a package?


Re: [web2py] Re: new dal

2010-12-06 Thread Jonathan Lundell
On Dec 6, 2010, at 9:13 AM, ron_m wrote:
> 
> I did an update of trunk using hg and copied dal.py over sql.py in
> gluon and start the web2py.py server and still get
> 
> Traceback (most recent call last):
>  File "/home/camcentral/Dev/web2py_hg/gluon/main.py", line 446, in
> wsgibase
>BaseAdapter.close_all_instances(BaseAdapter.commit)
>  File "/home/camcentral/Dev/web2py_hg/gluon/sql.py", line 276, in
> close_all_instances
>self.connection.close()
> NameError: global name 'self' is not defined
> 
> main is calling BaseAdapter.close_all_instances() as a class method so
> the self reference at line 276 blows up because there is no instance
> of a class. I see from the latest post we can test dal.py standalone,
> are we not to be testing as part of web2py yet because of integration
> issues?

Judging from the parallel code in sql.py, you might try replacing 'self' with 
'instance' in dal.ConnectionPool.close_all_instances (3 places).

> 
> Ron
> 
> On Dec 5, 7:11 pm, mdipierro  wrote:
>> started work integrating with gluon/contrib/gql.py do
>> 
>> please keep testing dal.py
>> 
>> now it no longer requires web2py and you can do
>> 
>> % python>>> from dal import DAL, Field
> db=DAL('sqlite://file.sqlite')
> db.define_table('person',Field('name'))
>> 
>> etc etc.
>> 
>> you ONLY need dal.py
>> 
>> On Dec 5, 1:56 pm, mdipierro  wrote:
>> 
>>> in trunk!
>> 
>>> On Dec 5, 1:38 pm, "mr.freeze"  wrote:
>> 
 Auth.define_tables doesn't have a fake_migrate attribute so I added
 one (want a patch?). Once I did, my .table files were re-created when
 migrate=True and fake_migrate=True. It still works once I set
 fake_migrate to False. I will test it against the new DAL now.
>> 
 On Dec 5, 1:24 pm, mdipierro  wrote:
>> 
> can you try migrate=True, fake_migrate=True?
>> 
> On Dec 5, 1:05 pm, "mr.freeze"  wrote:
>> 
>> I tried and the file modification times of the .table files do not
>> change. I deleted them (safely backed up) and they are not re-created.
>> 
>> On Dec 5, 12:56 pm, mdipierro  wrote:
>> 
>>> It is the same. try without delete them.
>> 
>>> On Dec 5, 12:53 pm, "mr.freeze"  wrote:
>> 
 I reverted to the old DAL and did the steps you outlined. Same result.
 Should I delete the .table files first?
>> 
 On Dec 5, 12:41 pm, mdipierro  wrote:
>> 
> for the troublesome table (auth_user) set migrate=False,
> fake_migrate=True reload, then migrate=True and remove fake_migrate.
> It should fix your broken .table.
>> 
> Should work with old and with new dal.
>> 
> On Dec 5, 11:47 am, "mr.freeze"  wrote:
>> 
>> I seem to remember this failing before though. Something about
>> my .TABLE files being out of sync. What is the procedure to re-sync
>> them?
>> 
>> On Dec 5, 10:45 am, "mr.freeze"  wrote:
>> 
>>> I have a global variable migrate_db which is passed to all
>>> define_table functions. I switched it to false and get this:
>>> Traceback (most recent call last):
>>>   File "C:\web2py\gluon\restricted.py", line 188, in restricted
>>> exec ccode in environment
>>>   File "C:/web2py/applications/main/models/db.py", line 34, in
>>  
>>> readable=False, default=""),migrate=migrate_db)
>>>   File "C:\web2py\gluon\sql.py", line 1406, in define_table
>>> obj = str(obj)
>>>   File "C:\web2py\gluon\sql.py", line 1858, in _create
>>> 'boolean': 'CHAR(1)',
>>>   File "C:\web2py\gluon\sql.py", line 1024, in 
>>> 'string': 'CHAR(%(length)s)',
>>>   File "C:\Python26\lib\site-packages\MySQLdb\cursors.py", line 166,
>>> in execute
>>> self.errorhandler(self, exc, value)
>>>   File "C:\Python26\lib\site-packages\MySQLdb\connections.py", line
>>> 35, in defaulterrorhandler
>>> raise errorclass, errorvalue
>>> OperationalError: (1050, "Table 'auth_user' already exists")
>> 
>>> On Dec 5, 10:37 am, "mr.freeze"  wrote:
>> 
 Let me backup the web2pyslice.com database and I will try.
>> 
 On Dec 5, 10:36 am, mdipierro  wrote:
>> 
> can you try migrate=True (add a dummy field and the remove it) 
> with
> mysql?
>> 
> On Dec 5, 10:20 am, "mr.freeze"  wrote:
>> 
>> Working with mysql also. I tested with migrate=False. Nice work!
>> 
>> On Dec 5, 10:12 am, "mr.freeze"  wrote:
>> 
>>> Okay, web2pyslices.com source runs against it with a sqlite 
>>> database.
>>> I will test with mysql.
>> 
>>> On Dec 4, 11:02 pm, mdipierro  wrote:
>> 
 One more test please. I do not have mysql installed here so I 
 did not
 test pooling. This helps a lot. thanks.
>> 
 On Dec 4, 10:33 pm, "mr.freez