Re: [web2py] Stand Alone DAL and migrations (again)

2010-10-30 Thread Stef Mientki
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. 



Re: [web2py] Stand Alone DAL and migrations (again)

2010-10-30 Thread rochacbruno
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.
 


Re: [web2py] Stand Alone DAL and migrations (again)

2010-10-30 Thread Stef Mientki
thanks Bruno,

seems like a good starting point.

cheers,
Stef

On 30-10-2010 12:06, rochacbruno wrote:
 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 
 mailto: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. 




Re: [web2py] Stand Alone DAL and migrations (again)

2010-10-30 Thread Stef Mientki
On 30-10-2010 12:06, rochacbruno wrote:
 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.
hi Bruno,

one other question,
in the gtk application,
do you access the database through a local server,
or direct through a local disk location ?
And in the latter case, how do you specify a hard disk location ?

thanks,
Stef



 Em 30/10/2010, às 06:33, Stef Mientki stef.mien...@gmail.com 
 mailto: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. 




Re: [web2py] Stand Alone DAL and migrations (again)

2010-10-30 Thread Thadeus Burgess
Just my 2 cents.

Using the DAL on anything but web2py is going to be a pain in the ass and a
nightmare waiting to happen. This is due to its inherent forced procedural
coding style. You can wrap DAL calls as methods, but it just gets really
messy. I'm a clean code zealot, so I bet I care more than most.

For any kind of software your developing that uses object oriented
programming, use a database system that is structured around classes and
declarative bases. You will find this is much much much easier to integrate
into, for example a wxWidgets program, than the DAL is.

--
Thadeus




On Sat, Oct 30, 2010 at 7:29 AM, Stef Mientki stef.mien...@gmail.comwrote:

  On 30-10-2010 12:06, rochacbruno wrote:

 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.

 hi Bruno,

 one other question,
 in the gtk application,
 do you access the database through a local server,
 or direct through a local disk location ?
 And in the latter case, how do you specify a hard disk location ?

 thanks,
 Stef




 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.






Re: [web2py] Stand Alone DAL and migrations (again)

2010-10-30 Thread Stef Mientki
hi Thadeus,

On 30-10-2010 19:42, Thadeus Burgess wrote:
 Just my 2 cents.

 Using the DAL on anything but web2py is going to be a pain in the ass and a 
 nightmare waiting to
 happen. This is due to its inherent forced procedural coding style. You can 
 wrap DAL calls as
 methods, but it just gets really messy. I'm a clean code zealot, so I bet I 
 care more than most.
I guess I'm the opposite,
I'm not a programmer ( although I write code),
but I like the write with as few words as possible (and to learn and to know as 
little as possible),
to create the functionality I need ;-)

 For any kind of software your developing that uses object oriented 
 programming, use a database
 system that is structured around classes and declarative bases.
so what would be a good suggestion ?
 You will find this is much much much easier to integrate into, for example a 
 wxWidgets program,
 than the DAL is.
The reason to see if the DAL could be used for desktop applications:
I've a number of applications, that uses SQLite / Access / Sybase databases.
I want to make these applications independent of their underlying databases,
and want to possibility to move to SQL-Server / MySQL or PostGres.
My feeling tells me that about 80 to 90 % of the used SQL queries can be 
handled by an abstraction
layer like DAL.

I've looked at other abstraction layers in the past,
but found the learning step to high.

In fact I find the learning step for the Web2Py also too high ;-)
but as I've chozen Web2Py for web design,
I'll have to learn it anyway.

cheers,
Stef

 --
 Thadeus




[web2py] Stand Alone DAL and migrations (again)

2010-10-18 Thread Bruno Rocha
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.