[sqlalchemy] MSSQL negative SMALLINT returned by SA as weird number

2011-10-13 Thread Matt Bodman
I have a SMALLINT column in MSSQL. The value of the column is -2 SQLAlchemy also has the column as SMALLINT but the value is translated as 4294967294 I can't seem to correct this and I haven't found anything on SA and negative numbers. Any help would be really great, thanks. -- You

Re: [sqlalchemy] MSSQL negative SMALLINT returned by SA as weird number

2011-10-13 Thread Matt Bodman
makes sense.. I'm using pydobc. I do the test you suggested.. thanks! -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To view this discussion on the web visit https://groups.google.com/d/msg/sqlalchemy/-/4XlySuLtQxUJ. To post to this group, send

[sqlalchemy] Re: Softcoding .filter(...)

2011-09-29 Thread Matt Bodman
I think he means that if you only need an exact match on your query (instead of a 'like' or a '' etc) you can do this: dict_from_web = {'Title':'The Book','Author':'Bob Smith'} for b in session.query(Book).filter_by(**dict_from_web) will return the books that have the exact Title 'The Book'

Re: [sqlalchemy] skipping MSSQL TIMESTAMP column on INSERT

2011-09-25 Thread Matt Bodman
Thanks so much Michael.. just to wrap up this thread, I got it working like this: class Thing(Base): __tablename__ = 'tbThings' __table_args__ = ( {'autoload':True,'autoload_with':engine,'extend_existing':True} ) LastUpdated = Column('LastUpdated', TIMESTAMP,

[sqlalchemy] Autoloading ManyToMany association table

2011-09-25 Thread Matt Bodman
I am autoloading an MSSQL db. There are a few ManyToMany assoc tables. I'm not sure how to map everything. Here's a typical example of how they look in the db: Table: tbUsersToGroups PK: ID_UserToGroup FK: User_ID FK: Group_ID So I can successfully autoload that assoc table and

[sqlalchemy] skipping MSSQL TIMESTAMP column on INSERT

2011-09-15 Thread Matt Bodman
Hi, I am autoloading tables from an MSSQL db. A lot of the tables have the MSSQL TIMESTAMP column. So, when inserting to the table, I get an IntegrityError: sqlalchemy.exc.IntegrityError: (IntegrityError) ('23000', '[23000] [FreeTDS][SQL Server]Cannot insert an explicit value into a timestamp

Re: [sqlalchemy] skipping MSSQL TIMESTAMP column on INSERT

2011-09-15 Thread Matt Bodman
Hi Michael, Thanks for your reply. Please be patient with me though as I don't quite get it. Where and when is the add_default function called? Won't I get the same error trying to insert 'some default' into the column? Any further explanation would be great. Matt -- You received this