views:

36

answers:

1

I've read about using sqlalchemywithin the pylons framework.

How will things work if I need it for a simple script file?

I have like importer.py that is spidering a site and I want to save to mysql.

If things are in a single file, can I still using sqlalchemy?

How do I setup my model/mappings then?

+3  A: 

If things are in a single file, can I still using sqlalchemy?

Yes, SQLAlchemy does not impose any restrictions on the way you use it.

You can see example on single-script initialization here: http://www.sqlalchemy.org/trac/attachment/ticket/1328/sqlalchemy-bug-query_Employee_company.py

Daniel Kluev
thanks, what does: #!/usr/bin/env python mean at the top of the file?
Blankman
Its common unix way to run scripts, called 'shebang'. It tells shell to execute '/usr/bin/env with arg 'python'. env itself is a way to run different installations of python on same machine. You can read more on it here: http://virtualenv.openplans.org/ P.S. you can consider it as just equivalent of running python <scriptname> from command line.
Daniel Kluev