Hello, Everyone,

I'm getting to know SQLAlchemy after watching the PyCon tutorials and
have a couple of questions I hope you can either can/will answer for
me or point me in the correct direction.

I'm using SQLAlchemy v 0.5.3 with Python 2.6 on Windows hitting a SQL
Server database.  I am using reflection to define my Python objects
and can "see" the column names and values as expected.  Very nice.

Question 1:  In my database I have a timestamp column defined which
will default to the current system timestamp on the db server.  When I
create an object then "commit" it, the database complains about the ts
column.  Can I exclude it from the Insert query?  I found an earlier
thread on this but it appeared (to me) that the op was not using
reflection.  If I have a very simplified class:

class FileInfo(Base):
       __table__ = Table('file_info', metadata, autoload=True)

       def __init__(self, path, client):
             self.path = path
             self.client = client

How would I specify not to add a ts column (which exists in the db) to
the Insert query?

Question 2:  Along the same lines, using reflection, can I define
foreign keys and backrefs in my objects?  I'd like to link the above
"file_info" id to a "file_id" column in another table (also defined
using reflection).  I see how to do this when I explicitly define my
tables, but I have an existing database I would like to work with.

Thanks for your help.  I'm looking forward to learning more about all
of this!

--greg






--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to