I have a problem with the tutorial which I have been working through.
My environment is:--

postgres 8.1.3 running as localhost
python 2.4.3
sqlalchemy 0.2.4 release
windows 2000 sp3
psycopg 2.2

First question: I assume sqlalchemy is meant to work on windows. Other 
people seem to be running on windows from persusing the mailing list

My problem is based on the firststeps.py sample.
The problem I get is if I do as follows:--

> userocs = Table('users', metadata, autoload=True)
to make sqlalcheny read the metadata from the database for an existing 
file. The program hangs and I get no error message, no traceback and I 
have to kill the program to exit.

If I include the table spec. as follows:

> userocs = Table('users', metadata,
>     Column('user_id', Integer, primary_key=True),
>     Column('name', String(40)),
>     Column('age', Integer),
>     Column('password', String),
> )
everything works as expected and the rest of the sample firststeps 
produces the right results.

I have searched the archives looking for appropriate clues but have not 
found anything that relates to my particular problem.

Has anyone else tried this exercise on windows 2000 or xp without problem.
Have I misunderstood how this is supposed to be coded.

If anyone can give me a pointer to what to look at I would be grateful.

Here is the complete code as I use it.

> from sqlalchemy import *
>
> #db = create_engine('sqlite:///tutorial.db')
> db = create_engine('postgres://postgres:[EMAIL PROTECTED]:5432/rocs')
> db.echo = True  # Try changing this to True and see what happens
>
> metadata = BoundMetaData(db)
>
> userocs = Table('users', metadata,
>     Column('user_id', Integer, primary_key=True),
>     Column('name', String(40)),
>     Column('age', Integer),
>     Column('password', String),
> )
> userocs = Table('users', metadata, autoload=True)
>
> s = userocs.select()
> rs = s.execute()
>
> row = rs.fetchone()
> print 'Id:', row[0]
> print 'Name:', row['name']
> print 'Age:', row.age
> print 'Password:', row[userocs.c.password]
>
> for row in rs:
>     print row.name, 'is', row.age, 'years old'
>     print row
Thanks for any info.

John Aherne



Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to