Look this simple example:

http://bitbucket.org/rochacbruno/dal_on_flask/src/tip/dalFlask.py


I have a PyGTK app running very well, I will put the code online soon.



Em 30/10/2010, às 06:33, Stef Mientki <stef.mien...@gmail.com> escreveu:

> Interesting ...
> as I want to migrate to web2py
> and want to have some kind of DAL for my desktop applications,
> this sounds very good.
> 
> Can you give me some guide lines, how to use the web2py DAL for desktop 
> applications ?
> 
> thanks,
> Stef Mientki
> 
> 
> On 19-10-2010 05:44, Bruno Rocha wrote:
>> 
>> I know DAL was not made for that, but I'm using the DAL in a desktop 
>> application with PyGTK, and it is working very well :-)
>> 
>> It is a simple application that monitors the presence of employees       in 
>> a company and reads small CSV files from a time clock,
>> people has cards that open the gates/doors of the company factory, I use a 
>> stream to read the track from serial port of time clock,
>> then, I take the information serialized as CSV, I parse and write it into 
>> SQLite db, after that , the Janitor uses a PyGTK app to access that 
>> information.
>> 
>> already been running for about 6 months, So far everything is working fine, 
>> but I can not run the automatic migrations.
>> 
>> Does anyone know a way to make migration work automatically with DAL Stand 
>> Alone?
>> 
>> I'm importing sql.py I'm connecting with SQLite, setting tables, accessing 
>> and doing out any crud operation.
>> 
>> The only thing missing is to make migration works.
>> 
>> I already set migrate='Mytable.table' and I tried with migrate=True
>> 
>> ----
>> An example of what I have working in my 
>> 
>> "connect.py"
>> >>> from gluon.sql import *
>> >>> db = DAL('sqlite://timeclock1.db')
>> >>> Track = 
>> >>> db.define_table('track',Field('regnumber','integer'),Field('action','integer'),Field('timestamp','datetime'),migrate='track.table')
>> 
>> "Form_workflow.py"
>> >>> Track.insert(regnumber=123,action=2,timestamp='2010-10-19')
>> 1
>> >>> Track.insert(regnumber=124,action=2,timestamp='2010-10-19')
>> 2
>> >>> db.commit
>> 
>> Until here, its ok.
>> 
>> But now I am wanting to change the model, and including Field('department')
>> 
>> "connect.py"
>> >>> Track = 
>> >>> db.define_table('track',Field('regnumber','integer'),Field('action','integer'),Field('timestamp','datetime'),Field('department'),migrate='track.table')
>> 
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in <module>
>>   File "/bin/DAL/gluon/sql.py", line 1346, in define_table
>>     raise SyntaxError, 'invalid table name: %s' % tablename
>> SyntaxError: invalid table name: track
>> >>> 
>> 
>> ----
>> 
>> If this is not possible, I'll have to create new fields in SQLite and then 
>> update my model.
> 

Reply via email to