Its not about can it be used stand alone. Its about how you have to
structure your code when you do. The only reason the DAL works well with
web2py is because web2py is executed and designed to be functionally coded.

I would suggest SQLAlchemy. Its designed with OOP in mind, and offers more
features than the DAL. However, Like I said, if your not concerned with
using an OOP design, then the DAL Is probably fine.

I have been here, done this. I already have wrote wxWidgets applications
that attempted to use the DAL standalone. It worked... but I soon learned
SQLAlchemy was much better suited for the job. I speak from experience.

If all you are doing is one or two models, then DAL is probably is fine. My
application of using the DAL standalone contained over 50 models, all
interconnected and weaved into each other. I also needed to organize my code
and have all of the models split up into their own files.

--
Thadeus




On Sat, Oct 30, 2010 at 2:07 PM, mdipierro <mdipie...@cs.depaul.edu> wrote:

> well. I disagree. ;-)
>
> http://web2py.com/AlterEgo/default/show/215
>
> On 30 oct, 12:42, Thadeus Burgess <thade...@thadeusb.com> 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.
> >
> > 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.com
> >wrote:
> >
> > >  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.
> >
> >
>

Reply via email to