Somebody knows a trick?

2010/10/19 Bruno Rocha <[email protected]>

> I forgot to mention that I tried:
>
>  DAL(....,folder=...) pointing folder="" to the directory where .table
> files are, but does not works.
>
> 2010/10/19 Bruno Rocha <[email protected]>
>
> 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.
>
>
>
>
> --
>
> http://rochacbruno.com.br
>



-- 

http://rochacbruno.com.br

Reply via email to