Re: [sqlalchemy] lockmode
It's just a basic select statement I do not see any other parms. Thanks Michael Mileusnich On Sun, Jul 18, 2010 at 5:05 PM, Michael Bayer mike...@zzzcomputing.comwrote: What does your SQL output say? Do you see FOR UPDATE in the log? Sent from my iPhone On Jul 17, 2010, at 8:47 PM, Michael Mileusnich justmike2...@gmail.com wrote: Hello, I am running Python 2.6 SQL Alchemy 0.5.8 against MS SQL Server Express 2008 with pyODBC. When I issue something like: sess.query(job).with_lockmode(update) It does not seem to be locking according to the query I am getting back from my profiler. Is this the correct usage? Thanks Mike -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.comsqlalchemy%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.comsqlalchemy%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@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.
[sqlalchemy] lockmode
Hello, I am running Python 2.6 SQL Alchemy 0.5.8 against MS SQL Server Express 2008 with pyODBC. When I issue something like: sess.query(job).with_lockmode(update) It does not seem to be locking according to the query I am getting back from my profiler. Is this the correct usage? Thanks Mike -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@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.
Re: [sqlalchemy] list filter
Hello, I believe this is what you are looking for: .filter(obj.in([1, 2, 3])) On Fri, Apr 23, 2010 at 9:33 AM, Alexander Zhabotinskiy a.zhabotins...@gmail.com wrote: Hello. How to filter by list may be like: .filter(Some.value==[1,2,3]) -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.comsqlalchemy%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@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.
[sqlalchemy] Re: Threading
It seems the problem is something else. A while back I ran into issues where on Windows and MS SQL, my data was not not being inserted into my tables. For some reason, by adding metadata.createall() right before I return my Session in my getsession() function, data started inserting again. This worked for both Windows, Mac, and Linux. Now switching my app to use the multiprocessor threadin library, that metadata.createall() throws all kinds of errors on Mac/Linux, if I remove it everything runs great except on Windows where data does not insert again. Any ideas where I should start looking? On Thu, Sep 10, 2009 at 11:10 AM, Michael Bayer mike...@zzzcomputing.comwrote: Michael Mileusnich wrote: I have a db file with a function called getsession() that returns my Session which has been established to = a scoped session. The odd thing is it works fine on my Windows XP machine, however on my ubuntu box it throws errors. I guess I'll reply later today with the errors. Thanks Michael Mileusnich keep in mind that DBAPI connections are usually not going to persist across a fork() on a unix system, so that each time you start a new child process, you have to create a new engine and ensure that the engine of the parent process is no longer accessed. On Thu, Sep 10, 2009 at 10:10 AM, Michael Bayer mike...@zzzcomputing.comwrote: Michael Mileusnich wrote: I have switched my application to use the Python multiprocessor threading instead if the default python gil threading. I seem to be running into issues. I am using scoped sessions and in my run() function, when I try to do sess = getsession() to grab the session sql alchemy throws a large number of errors. Is this supported? I'm assuming you're referring to the multiprocessing module in Python 2.6. It is absolutely supported, I run several applications in a production environment with heavy usage of multiprocessing. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] Threading
I have switched my application to use the Python multiprocessor threading instead if the default python gil threading. I seem to be running into issues. I am using scoped sessions and in my run() function, when I try to do sess = getsession() to grab the session sql alchemy throws a large number of errors. Is this supported? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: Threading
I have a db file with a function called getsession() that returns my Session which has been established to = a scoped session. The odd thing is it works fine on my Windows XP machine, however on my ubuntu box it throws errors. I guess I'll reply later today with the errors. Thanks Michael Mileusnich On Thu, Sep 10, 2009 at 10:10 AM, Michael Bayer mike...@zzzcomputing.comwrote: Michael Mileusnich wrote: I have switched my application to use the Python multiprocessor threading instead if the default python gil threading. I seem to be running into issues. I am using scoped sessions and in my run() function, when I try to do sess = getsession() to grab the session sql alchemy throws a large number of errors. Is this supported? I'm assuming you're referring to the multiprocessing module in Python 2.6. It is absolutely supported, I run several applications in a production environment with heavy usage of multiprocessing. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] cascades and mappers
To get foreign keys in my python app I am doing the following: ForeignKeyConstraint(['USERID'], ['USERS.USERID'], ondelete=CASCADE) and my mappers are nothing more than mapper(class, table). Is there anything wrong with not defining the relation in the mapper as well? Also, is there a way for sqlalchemy to manage cascades for databases that do not support it (sql-lite, etc)? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] session flush
I know I have asked this before but I would like some clarification. If I do something like : i = query(table).all for instance in i: thread_class(i.ID) thread_class.start() del thread_class and do an additional query in the init of the thread_class to pull up the entire record for i using the ID passed into variable fetch_i, can I do sess.flush() and fetch_i be updated? I am using a scoped session and sometimes I get the following error: Traceback (most recent call last): File D:\Python26\lib\threading.py, line 522, in __bootstrap_inner self.run() File C:\Dev\jlaunch.py, line 253, in run self.sess.flush() File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ session.py, line 1347, in flush raise sa_exc.InvalidRequestError(Session is already flushing) InvalidRequestError: Session is already flushing Am I going about this wrong? Python 2.6 pyodbc-2.1.3.win32-py2.6 sqlalchemy-0.5.3-py2.6 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] Session is already flushing
I am using a scoped session in my sql alchemy app. Can anybody help me with what this error means: Session is already flushing _mysql_exceptions.ProgrammingError: (2014, Commands out of sync; you can't run this command now5 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: pyodbc issues
On Mon, Apr 27, 2009 at 6:08 PM, Michael Trier mtr...@gmail.com wrote: Okay I'll get rid of it. On Apr 27, 2009, at 6:04 PM, Michael Bayer mike...@zzzcomputing.com wrote: I'd love to revert that change and just say MSSQL doesn't support SAVEPOINT for now. or put an enable_savepoint flag in the dialect. polaar wrote: Could this be related to this change: http://www.sqlalchemy.org/trac/changeset/5564 I encountered a similar problem with mssql/pyodbc today (the echo output showed the correct statements and params, but no changes seemed to be made in the db at all). The problem only occurred when using the orm/session layer, same statements with engine.execute seemed to work. I managed to fix it by reverting the change with the following monkeypatch: from sqlalchemy.databases.mssql import MSSQLDialect MSSQLDialect.do_begin = lambda self, conn: pass Not sure this is related though (or if this is a good solution), just thought I'd let it know in case it helps. greetings, Steven On 25 apr, 15:05, Michael Trier mtr...@gmail.com wrote: On Apr 24, 2009, at 7:50 PM, Michael Mileusnich justmike2...@gmail.com wrote: Wow..your example worked for me. Could the kwargs the issue? No. Likely you have some sort of conflict on the dbapi side. If it's possible for you to send me your actual code (mtr...@gmail.com) I'd be happy to try and figure out the issue. On Fri, Apr 24, 2009 at 3:14 PM, mtrier mtr...@gmail.com wrote: On Apr 24, 2009, at 4:02 AM, Michael Mileusnich wrote: I have formated my PC with Vista 32. I also Installed SQL Server 2008 Express. Installed Python 2.6 and pyodbc...SAME ISSUE. I would be willing to have somebody overlook my python code. With echo on everything looks like it should be INSERTING. I've written this script based on the information you have supplied. It works fine for me: from sqlalchemy import * from sqlalchemy.orm import * engine = create_engine('mssql://sprint:spr...@localhost/sprint', echo=True) metadata = MetaData(engine) Session = scoped_session(sessionmaker(bind=engine, autoflush=False, autocommit=True)) action_table = Table( 'ACTIONS', metadata, Column('ACTIONID', String(48), primary_key=True), Column('TITLE', String(128)), Column('CMDLINE', String(512)), Column('STDIN', Text), Column('STARTINDIR', String(512)), Column('PRIO', Integer), ) class action(object): def __init__(self, ACTIONID, CMDLINE): self.ACTIONID = ACTIONID self.CMDLINE = CMDLINE def __repr__(self): return action('%s', '%s') % (self.ACTIONID, self.CMDLINE) mapper(action, action_table) metadata.create_all() session = Session() new_action = action(ACTIONID = '500', CMDLINE = 'sol') session.add(new_action) session.flush() session.expunge_all() act = session.query(action).filter_by(ACTIONID='500').one() assert new_action.ACTIONID == act.ACTIONID -- Would you please try it and let me know what results you get. The following is my output. S:\sqlalchemy.git\libpython msssqlprob.py 2009-04-24 16:10:30,473 INFO sqlalchemy.engine.base.Engine.0x... 6110 SELECT user_name() as user_name; 2009-04-24 16:10:30,552 INFO sqlalchemy.engine.base.Engine.0x... 6110 [] 2009-04-24 16:10:30,568 INFO sqlalchemy.engine.base.Engine.0x... 6110 SELECT default_schema_name FROM sys.database_principals WHERE name = ? AND type = 'S' 2009-04-24 16:10:30,568 INFO sqlalchemy.engine.base.Engine.0x... 6110 [u'dbo'] 2009-04-24 16:10:30,582 INFO sqlalchemy.engine.base.Engine.0x... 6110 SELECT [COLUMNS_1].[TABLE_SCHEMA], [COLUMNS_1].[TAB LE_NAME], [COLUMNS_1].[COLUMN_NAME], [COLUMNS_1].[IS_NULLABLE], [COLUMNS_1].[DATA_TYPE], [COLUMNS_1].[ORDINAL_POSITION], [COLUMNS_1].[CHARACTER_MAXIMUM_LENGTH], [COLUMNS_1]. [NUMERIC_PRECISION], [COLUMNS_1].[NUMERIC_SCALE], [COLUMNS_1].[COLU MN_DEFAULT], [COLUMNS_1].[COLLATION_NAME] FROM [INFORMATION_SCHEMA].[COLUMNS] AS [COLUMNS_1] WHERE [COLUMNS_1].[TABLE_NAME] = ? AND [COLUMNS_1].[TABLE_SCHEMA] = ? 2009-04-24 16:10:30,598 INFO sqlalchemy.engine.base.Engine.0x... 6110 ['ACTIONS', u'dbo'] 2009-04-24 16:10:30,598 INFO sqlalchemy.engine.base.Engine.0x... 6110 CREATE TABLE [ACTIONS] ( [ACTIONID] VARCHAR(48) NOT NULL, [TITLE] VARCHAR(128) NULL, [CMDLINE] VARCHAR(512) NULL, [STDIN] TEXT NULL, [STARTINDIR] VARCHAR(512) NULL, [PRIO] INTEGER NULL, PRIMARY KEY ([ACTIONID]) ) 2009-04-24 16:10:30,630 INFO sqlalchemy.engine.base.Engine.0x... 6110 () 2009-04-24 16:10:30,661 INFO sqlalchemy.engine.base.Engine.0x... 6110 COMMIT 2009-04-24 16:10:30,693 INFO sqlalchemy.engine.base.Engine.0x... 6110 BEGIN 2009-04-24 16
[sqlalchemy] Re: pyodbc issues
Id like to thank you for all your help however is my solution adequate to use in that I perform a metadata.create_all() in the function in my db.py python file that returns the session? On Mon, Apr 27, 2009 at 8:07 PM, Michael Mileusnich justmike2...@gmail.comwrote: On Mon, Apr 27, 2009 at 6:08 PM, Michael Trier mtr...@gmail.com wrote: Okay I'll get rid of it. On Apr 27, 2009, at 6:04 PM, Michael Bayer mike...@zzzcomputing.com wrote: I'd love to revert that change and just say MSSQL doesn't support SAVEPOINT for now. or put an enable_savepoint flag in the dialect. polaar wrote: Could this be related to this change: http://www.sqlalchemy.org/trac/changeset/5564 I encountered a similar problem with mssql/pyodbc today (the echo output showed the correct statements and params, but no changes seemed to be made in the db at all). The problem only occurred when using the orm/session layer, same statements with engine.execute seemed to work. I managed to fix it by reverting the change with the following monkeypatch: from sqlalchemy.databases.mssql import MSSQLDialect MSSQLDialect.do_begin = lambda self, conn: pass Not sure this is related though (or if this is a good solution), just thought I'd let it know in case it helps. greetings, Steven On 25 apr, 15:05, Michael Trier mtr...@gmail.com wrote: On Apr 24, 2009, at 7:50 PM, Michael Mileusnich justmike2...@gmail.com wrote: Wow..your example worked for me. Could the kwargs the issue? No. Likely you have some sort of conflict on the dbapi side. If it's possible for you to send me your actual code (mtr...@gmail.com) I'd be happy to try and figure out the issue. On Fri, Apr 24, 2009 at 3:14 PM, mtrier mtr...@gmail.com wrote: On Apr 24, 2009, at 4:02 AM, Michael Mileusnich wrote: I have formated my PC with Vista 32. I also Installed SQL Server 2008 Express. Installed Python 2.6 and pyodbc...SAME ISSUE. I would be willing to have somebody overlook my python code. With echo on everything looks like it should be INSERTING. I've written this script based on the information you have supplied. It works fine for me: from sqlalchemy import * from sqlalchemy.orm import * engine = create_engine('mssql://sprint:spr...@localhost/sprint', echo=True) metadata = MetaData(engine) Session = scoped_session(sessionmaker(bind=engine, autoflush=False, autocommit=True)) action_table = Table( 'ACTIONS', metadata, Column('ACTIONID', String(48), primary_key=True), Column('TITLE', String(128)), Column('CMDLINE', String(512)), Column('STDIN', Text), Column('STARTINDIR', String(512)), Column('PRIO', Integer), ) class action(object): def __init__(self, ACTIONID, CMDLINE): self.ACTIONID = ACTIONID self.CMDLINE = CMDLINE def __repr__(self): return action('%s', '%s') % (self.ACTIONID, self.CMDLINE) mapper(action, action_table) metadata.create_all() session = Session() new_action = action(ACTIONID = '500', CMDLINE = 'sol') session.add(new_action) session.flush() session.expunge_all() act = session.query(action).filter_by(ACTIONID='500').one() assert new_action.ACTIONID == act.ACTIONID -- Would you please try it and let me know what results you get. The following is my output. S:\sqlalchemy.git\libpython msssqlprob.py 2009-04-24 16:10:30,473 INFO sqlalchemy.engine.base.Engine.0x... 6110 SELECT user_name() as user_name; 2009-04-24 16:10:30,552 INFO sqlalchemy.engine.base.Engine.0x... 6110 [] 2009-04-24 16:10:30,568 INFO sqlalchemy.engine.base.Engine.0x... 6110 SELECT default_schema_name FROM sys.database_principals WHERE name = ? AND type = 'S' 2009-04-24 16:10:30,568 INFO sqlalchemy.engine.base.Engine.0x... 6110 [u'dbo'] 2009-04-24 16:10:30,582 INFO sqlalchemy.engine.base.Engine.0x... 6110 SELECT [COLUMNS_1].[TABLE_SCHEMA], [COLUMNS_1].[TAB LE_NAME], [COLUMNS_1].[COLUMN_NAME], [COLUMNS_1].[IS_NULLABLE], [COLUMNS_1].[DATA_TYPE], [COLUMNS_1].[ORDINAL_POSITION], [COLUMNS_1].[CHARACTER_MAXIMUM_LENGTH], [COLUMNS_1]. [NUMERIC_PRECISION], [COLUMNS_1].[NUMERIC_SCALE], [COLUMNS_1].[COLU MN_DEFAULT], [COLUMNS_1].[COLLATION_NAME] FROM [INFORMATION_SCHEMA].[COLUMNS] AS [COLUMNS_1] WHERE [COLUMNS_1].[TABLE_NAME] = ? AND [COLUMNS_1].[TABLE_SCHEMA] = ? 2009-04-24 16:10:30,598 INFO sqlalchemy.engine.base.Engine.0x... 6110 ['ACTIONS', u'dbo'] 2009-04-24 16:10:30,598 INFO sqlalchemy.engine.base.Engine.0x... 6110 CREATE TABLE [ACTIONS] ( [ACTIONID] VARCHAR(48) NOT NULL, [TITLE] VARCHAR(128) NULL, [CMDLINE] VARCHAR(512) NULL, [STDIN] TEXT NULL, [STARTINDIR] VARCHAR(512) NULL, [PRIO] INTEGER NULL, PRIMARY KEY
[sqlalchemy] Re: pyodbc issues
I will try to come up with a test case later this week. On Mon, Apr 27, 2009 at 10:42 PM, mtrier mtr...@gmail.com wrote: On Apr 27, 9:10 pm, Michael Mileusnich justmike2...@gmail.com wrote: Id like to thank you for all your help however is my solution adequate to use in that I perform a metadata.create_all() in the function in my db.py python file that returns the session? On Mon, Apr 27, 2009 at 8:07 PM, Michael Mileusnich justmike2...@gmail.comwrote: On Mon, Apr 27, 2009 at 6:08 PM, Michael Trier mtr...@gmail.com wrote: Okay I'll get rid of it. On Apr 27, 2009, at 6:04 PM, Michael Bayer mike...@zzzcomputing.com wrote: I'd love to revert that change and just say MSSQL doesn't support SAVEPOINT for now. or put an enable_savepoint flag in the dialect. With r5930 I've moved all savepoint logic into savepoint oriented routines so it will not step on non-savepoint based code. Savepoint support is still very experimental in mssql. I'd appreciate as many eyes as possible on this changeset, as well as testing it out against problem code to see if this corrects our issues. At this point I'm pretty satisfied with the implementation based on the tests. I only have one failing test and after a couple of hours of comparing profile traces I'm still unable to understand why it's failing. The trace results are exactly the same. All other savepoint related tests are passing just fine. If this changeset still creates a problem (it shouldn't) let me know and we'll just revert all savepoint functionality. As of yet I still have not seen an isolated test case that illustrates the failures, so that makes me a bit uneasy in making code changes. So, if someone could produce an isolated test case that fails on the previous version of trunk that would still be very helpful to understand where the problem is. Thanks for everyone's help. Michael --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: pyodbc issues
I added the metadata.create_all() to me function that returns the session and everything seems to insert...I thought the metadata.create_all was only used to create the tables? On Sat, Apr 25, 2009 at 8:05 AM, Michael Trier mtr...@gmail.com wrote: On Apr 24, 2009, at 7:50 PM, Michael Mileusnich justmike2...@gmail.com wrote: Wow..your example worked for me. Could the kwargs the issue? No. Likely you have some sort of conflict on the dbapi side. If it's possible for you to send me your actual code (mtr...@gmail.com) I'd be happy to try and figure out the issue. On Fri, Apr 24, 2009 at 3:14 PM, mtrier mtr...@gmail.com wrote: On Apr 24, 2009, at 4:02 AM, Michael Mileusnich wrote: I have formated my PC with Vista 32. I also Installed SQL Server 2008 Express. Installed Python 2.6 and pyodbc...SAME ISSUE. I would be willing to have somebody overlook my python code. With echo on everything looks like it should be INSERTING. I've written this script based on the information you have supplied. It works fine for me: from sqlalchemy import * from sqlalchemy.orm import * engine = create_engine('mssql://sprint:spr...@localhost/sprint', echo=True) metadata = MetaData(engine) Session = scoped_session(sessionmaker(bind=engine, autoflush=False, autocommit=True)) action_table = Table( 'ACTIONS', metadata, Column('ACTIONID', String(48), primary_key=True), Column('TITLE', String(128)), Column('CMDLINE', String(512)), Column('STDIN', Text), Column('STARTINDIR', String(512)), Column('PRIO', Integer), ) class action(object): def __init__(self, ACTIONID, CMDLINE): self.ACTIONID = ACTIONID self.CMDLINE = CMDLINE def __repr__(self): return action('%s', '%s') % (self.ACTIONID, self.CMDLINE) mapper(action, action_table) metadata.create_all() session = Session() new_action = action(ACTIONID = '500', CMDLINE = 'sol') session.add(new_action) session.flush() session.expunge_all() act = session.query(action).filter_by(ACTIONID='500').one() assert new_action.ACTIONID == act.ACTIONID -- Would you please try it and let me know what results you get. The following is my output. S:\sqlalchemy.git\libpython msssqlprob.py 2009-04-24 16:10:30,473 INFO sqlalchemy.engine.base.Engine.0x...6110 SELECT user_name() as user_name; 2009-04-24 16:10:30,552 INFO sqlalchemy.engine.base.Engine.0x...6110 [] 2009-04-24 16:10:30,568 INFO sqlalchemy.engine.base.Engine.0x...6110 SELECT default_schema_name FROM sys.database_principals WHERE name = ? AND type = 'S' 2009-04-24 16:10:30,568 INFO sqlalchemy.engine.base.Engine.0x...6110 [u'dbo'] 2009-04-24 16:10:30,582 INFO sqlalchemy.engine.base.Engine.0x...6110 SELECT [COLUMNS_1].[TABLE_SCHEMA], [COLUMNS_1].[TAB LE_NAME], [COLUMNS_1].[COLUMN_NAME], [COLUMNS_1].[IS_NULLABLE], [COLUMNS_1].[DATA_TYPE], [COLUMNS_1].[ORDINAL_POSITION], [COLUMNS_1].[CHARACTER_MAXIMUM_LENGTH], [COLUMNS_1]. [NUMERIC_PRECISION], [COLUMNS_1].[NUMERIC_SCALE], [COLUMNS_1].[COLU MN_DEFAULT], [COLUMNS_1].[COLLATION_NAME] FROM [INFORMATION_SCHEMA].[COLUMNS] AS [COLUMNS_1] WHERE [COLUMNS_1].[TABLE_NAME] = ? AND [COLUMNS_1].[TABLE_SCHEMA] = ? 2009-04-24 16:10:30,598 INFO sqlalchemy.engine.base.Engine.0x...6110 ['ACTIONS', u'dbo'] 2009-04-24 16:10:30,598 INFO sqlalchemy.engine.base.Engine.0x...6110 CREATE TABLE [ACTIONS] ( [ACTIONID] VARCHAR(48) NOT NULL, [TITLE] VARCHAR(128) NULL, [CMDLINE] VARCHAR(512) NULL, [STDIN] TEXT NULL, [STARTINDIR] VARCHAR(512) NULL, [PRIO] INTEGER NULL, PRIMARY KEY ([ACTIONID]) ) 2009-04-24 16:10:30,630 INFO sqlalchemy.engine.base.Engine.0x...6110 () 2009-04-24 16:10:30,661 INFO sqlalchemy.engine.base.Engine.0x...6110 COMMIT 2009-04-24 16:10:30,693 INFO sqlalchemy.engine.base.Engine.0x...6110 BEGIN 2009-04-24 16:10:30,707 INFO sqlalchemy.engine.base.Engine.0x...6110 INSERT INTO [ACTIONS] ([ACTIONID], [TITLE], [CMDLIN E], [STDIN], [STARTINDIR], [PRIO]) VALUES (?, ?, ?, ?, ?, ?) 2009-04-24 16:10:30,707 INFO sqlalchemy.engine.base.Engine.0x...6110 ['500', None, 'sol', None, None, None] 2009-04-24 16:10:30,723 INFO sqlalchemy.engine.base.Engine.0x...6110 COMMIT 2009-04-24 16:10:30,723 INFO sqlalchemy.engine.base.Engine.0x...6110 SELECT TOP 2 [ACTIONS].[ACTIONID] AS [ACTIONS_ACTIO NID], [ACTIONS].[TITLE] AS [ACTIONS_TITLE], [ACTIONS].[CMDLINE] AS [ACTIONS_CMDLINE], [ACTIONS].[STDIN] AS [ACTIONS_STDI N], [ACTIONS].[STARTINDIR] AS [ACTIONS_STARTINDIR], [ACTIONS].[PRIO] AS [ACTIONS_PRIO] FROM [ACTIONS] WHERE [ACTIONS].[ACTIONID] = ? 2009-04-24 16:10:30,740 INFO sqlalchemy.engine.base.Engine.0x...6110 ['500'] Michael Trier http://michaeltrier.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups
[sqlalchemy] Re: pyodbc issues
I have formated my PC with Vista 32. I also Installed SQL Server 2008 Express. Installed Python 2.6 and pyodbc...SAME ISSUE. I would be willing to have somebody overlook my python code. With echo on everything looks like it should be INSERTING. On Wed, Apr 22, 2009 at 1:40 AM, Michael Mileusnich justmike2...@gmail.comwrote: I tried reinstalled pyodbc many times. Still creates the tables just fine but no inserts. Am I doing this correctly: db.py contains: engine create scoped session table definitions mappers meta creates/delete each object has its own .py for example servers.py but contains no column information about that table. then I run a file which makes a server object, adds to session, flush... On Tue, Apr 21, 2009 at 10:42 AM, Michael Trier mtr...@gmail.com wrote: The trace looks fine to me. I'll try to test it myself tonight. Sent from mobile On Apr 20, 2009, at 10:45 PM, Michael Mileusnich justmike2...@gmail.com wrote: Any update on this? On Fri, Apr 17, 2009 at 6:07 PM, Michael Mileusnich justmike2...@gmail.com justmike2...@gmail.com wrote: Actually I made a mistake in running some of these py files manually. The tables exist now and this is what I receive: 2009-04-17 19:04:59,780 INFO sqlalchemy.engine.base.Engine.0x...1230 () 2009-04-17 19:04:59,796 INFO sqlalchemy.engine.base.Engine.0x...1230 COMMIT C:\Dev\pyschedpython createservers.py D:\Python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\databases\ms sql.py:977: DeprecationWarning: object.__new__() takes no parameters return super(MSSQLDialect, cls).__new__(cls, *args, **kwargs) 2009-04-17 19:05:07,203 INFO sqlalchemy.engine.base.Engine.0x...0270 BEGIN 2009-04-17 19:05:07,217 INFO sqlalchemy.engine.base.Engine.0x...0270 INSERT INTO [SERVERS] ([SERVER], [IP], [PORT], [OS], [JSERVER], [STARTED], [STDIN], [LOGIN] , [CWD], [ASSIGNEDONLY]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 2009-04-17 19:05:07,217 INFO sqlalchemy.engine.base.Engine.0x...0270 ['agent1', '192.168.0.100', 2000, 0, None, 1, 1, 1, 1, 0] 2009-04-17 19:05:07,217 INFO sqlalchemy.engine.base.Engine.0x...0270 COMMIT On Fri, Apr 17, 2009 at 5:58 PM, Michael Trier mtr...@gmail.com mtr...@gmail.com wrote: The SERVERS table doesn't exist according to the trace. Did you create your tables? Sent from mobile On Apr 17, 2009, at 7:31 PM, Michael Mileusnich justmike2...@gmail.com justmike2...@gmail.com wrote: C:\Dev\pyschedpython createservers.py D:\Python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\databases\ms sql.py:977: DeprecationWarning: object.__new__() takes no parameters return super(MSSQLDialect, cls).__new__(cls, *args, **kwargs) 2009-04-17 18:29:10,421 INFO sqlalchemy.engine.base.Engine.0x...0270 BEGIN 2009-04-17 18:29:10,437 INFO sqlalchemy.engine.base.Engine.0x...0270 INSERT INTO [SERVERS] ([SERVER], [IP], [PORT], [OS], [JSERVER], [STARTED], [STDIN], [LOGIN] , [CWD], [ASSIGNEDONLY]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 2009-04-17 18:29:10,437 INFO sqlalchemy.engine.base.Engine.0x...0270 ['agent1', '192.168.0.100', 2000, 0, None, 1, 1, 1, 1, 0] 2009-04-17 18:29:10,500 INFO sqlalchemy.engine.base.Engine.0x...0270 ROLLBACK Traceback (most recent call last): File createservers.py, line 9, in module session.flush() File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ session.py, line 1351, in flush self._flush(objects) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ session.py, line 1422, in _flush flush_context.execute() File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ unitofwork.py, line 244, in execute UOWExecutor().execute(self, tasks) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ unitofwork.py, line 707, in execute self.execute_save_steps(trans, task) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ unitofwork.py, line 722, in execute_save_steps self.save_objects(trans, task) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ unitofwork.py, line 713, in save_objects task.mapper._save_obj(task.polymorphic_tosave_objects, trans) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ mapper.py, line 1347, in _save_obj c = connection.execute(statement.values(value_params), params) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\engi ne\base.py, line 824, in execute return Connection.executors[c](self, object, multiparams, params) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\engi ne\base.py, line 874, in _execute_clauseelement return self.__execute_context(context) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\engi ne\base.py, line 896, in __execute_context self
[sqlalchemy] Re: pyodbc issues
yes On Fri, Apr 24, 2009 at 8:47 AM, Michael Bayer mike...@zzzcomputing.comwrote: On Apr 24, 2009, at 4:02 AM, Michael Mileusnich wrote: I have formated my PC with Vista 32. I also Installed SQL Server 2008 Express. Installed Python 2.6 and pyodbc...SAME ISSUE. I would be willing to have somebody overlook my python code. With echo on everything looks like it should be INSERTING. and issuing COMMIT ? On Wed, Apr 22, 2009 at 1:40 AM, Michael Mileusnich justmike2...@gmail.com wrote: I tried reinstalled pyodbc many times. Still creates the tables just fine but no inserts. Am I doing this correctly: db.py contains: engine create scoped session table definitions mappers meta creates/delete each object has its own .py for example servers.py but contains no column information about that table. then I run a file which makes a server object, adds to session, flush... On Tue, Apr 21, 2009 at 10:42 AM, Michael Trier mtr...@gmail.com wrote: The trace looks fine to me. I'll try to test it myself tonight. Sent from mobile On Apr 20, 2009, at 10:45 PM, Michael Mileusnich justmike2...@gmail.com wrote: Any update on this? On Fri, Apr 17, 2009 at 6:07 PM, Michael Mileusnich justmike2...@gmail.com justmike2...@gmail.com wrote: Actually I made a mistake in running some of these py files manually. The tables exist now and this is what I receive: 2009-04-17 19:04:59,780 INFO sqlalchemy.engine.base.Engine.0x...1230 () 2009-04-17 19:04:59,796 INFO sqlalchemy.engine.base.Engine.0x...1230 COMMIT C:\Dev\pyschedpython createservers.py D:\Python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\databases\ms sql.py:977: DeprecationWarning: object.__new__() takes no parameters return super(MSSQLDialect, cls).__new__(cls, *args, **kwargs) 2009-04-17 19:05:07,203 INFO sqlalchemy.engine.base.Engine.0x...0270 BEGIN 2009-04-17 19:05:07,217 INFO sqlalchemy.engine.base.Engine.0x...0270 INSERT INTO [SERVERS] ([SERVER], [IP], [PORT], [OS], [JSERVER], [STARTED], [STDIN], [LOGIN] , [CWD], [ASSIGNEDONLY]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 2009-04-17 19:05:07,217 INFO sqlalchemy.engine.base.Engine.0x...0270 ['agent1', '192.168.0.100', 2000, 0, None, 1, 1, 1, 1, 0] 2009-04-17 19:05:07,217 INFO sqlalchemy.engine.base.Engine.0x...0270 COMMIT On Fri, Apr 17, 2009 at 5:58 PM, Michael Trier mtr...@gmail.com mtr...@gmail.com wrote: The SERVERS table doesn't exist according to the trace. Did you create your tables? Sent from mobile On Apr 17, 2009, at 7:31 PM, Michael Mileusnich justmike2...@gmail.com justmike2...@gmail.com wrote: C:\Dev\pyschedpython createservers.py D:\Python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\databases\ms sql.py:977: DeprecationWarning: object.__new__() takes no parameters return super(MSSQLDialect, cls).__new__(cls, *args, **kwargs) 2009-04-17 18:29:10,421 INFO sqlalchemy.engine.base.Engine.0x...0270 BEGIN 2009-04-17 18:29:10,437 INFO sqlalchemy.engine.base.Engine.0x...0270 INSERT INTO [SERVERS] ([SERVER], [IP], [PORT], [OS], [JSERVER], [STARTED], [STDIN], [LOGIN] , [CWD], [ASSIGNEDONLY]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 2009-04-17 18:29:10,437 INFO sqlalchemy.engine.base.Engine.0x...0270 ['agent1', '192.168.0.100', 2000, 0, None, 1, 1, 1, 1, 0] 2009-04-17 18:29:10,500 INFO sqlalchemy.engine.base.Engine.0x...0270 ROLLBACK Traceback (most recent call last): File createservers.py, line 9, in module session.flush() File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ session.py, line 1351, in flush self._flush(objects) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ session.py, line 1422, in _flush flush_context.execute() File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ unitofwork.py, line 244, in execute UOWExecutor().execute(self, tasks) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ unitofwork.py, line 707, in execute self.execute_save_steps(trans, task) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ unitofwork.py, line 722, in execute_save_steps self.save_objects(trans, task) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ unitofwork.py, line 713, in save_objects task.mapper._save_obj(task.polymorphic_tosave_objects, trans) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ mapper.py, line 1347, in _save_obj c = connection.execute(statement.values(value_params), params) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\engi ne\base.py, line 824, in execute return Connection.executors[c](self, object, multiparams, params) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\engi ne\base.py, line 874, in _execute_clauseelement return
[sqlalchemy] Re: pyodbc issues
Mine code looks the same except for: def __init__(self, **kwargs): for my ACTIONS. Should I try emailing pyodbc about this issue? On Fri, Apr 24, 2009 at 3:14 PM, mtrier mtr...@gmail.com wrote: On Apr 24, 2009, at 4:02 AM, Michael Mileusnich wrote: I have formated my PC with Vista 32. I also Installed SQL Server 2008 Express. Installed Python 2.6 and pyodbc...SAME ISSUE. I would be willing to have somebody overlook my python code. With echo on everything looks like it should be INSERTING. I've written this script based on the information you have supplied. It works fine for me: from sqlalchemy import * from sqlalchemy.orm import * engine = create_engine('mssql://sprint:spr...@localhost/sprint', echo=True) metadata = MetaData(engine) Session = scoped_session(sessionmaker(bind=engine, autoflush=False, autocommit=True)) action_table = Table( 'ACTIONS', metadata, Column('ACTIONID', String(48), primary_key=True), Column('TITLE', String(128)), Column('CMDLINE', String(512)), Column('STDIN', Text), Column('STARTINDIR', String(512)), Column('PRIO', Integer), ) class action(object): def __init__(self, ACTIONID, CMDLINE): self.ACTIONID = ACTIONID self.CMDLINE = CMDLINE def __repr__(self): return action('%s', '%s') % (self.ACTIONID, self.CMDLINE) mapper(action, action_table) metadata.create_all() session = Session() new_action = action(ACTIONID = '500', CMDLINE = 'sol') session.add(new_action) session.flush() session.expunge_all() act = session.query(action).filter_by(ACTIONID='500').one() assert new_action.ACTIONID == act.ACTIONID -- Would you please try it and let me know what results you get. The following is my output. S:\sqlalchemy.git\libpython msssqlprob.py 2009-04-24 16:10:30,473 INFO sqlalchemy.engine.base.Engine.0x...6110 SELECT user_name() as user_name; 2009-04-24 16:10:30,552 INFO sqlalchemy.engine.base.Engine.0x...6110 [] 2009-04-24 16:10:30,568 INFO sqlalchemy.engine.base.Engine.0x...6110 SELECT default_schema_name FROM sys.database_principals WHERE name = ? AND type = 'S' 2009-04-24 16:10:30,568 INFO sqlalchemy.engine.base.Engine.0x...6110 [u'dbo'] 2009-04-24 16:10:30,582 INFO sqlalchemy.engine.base.Engine.0x...6110 SELECT [COLUMNS_1].[TABLE_SCHEMA], [COLUMNS_1].[TAB LE_NAME], [COLUMNS_1].[COLUMN_NAME], [COLUMNS_1].[IS_NULLABLE], [COLUMNS_1].[DATA_TYPE], [COLUMNS_1].[ORDINAL_POSITION], [COLUMNS_1].[CHARACTER_MAXIMUM_LENGTH], [COLUMNS_1]. [NUMERIC_PRECISION], [COLUMNS_1].[NUMERIC_SCALE], [COLUMNS_1].[COLU MN_DEFAULT], [COLUMNS_1].[COLLATION_NAME] FROM [INFORMATION_SCHEMA].[COLUMNS] AS [COLUMNS_1] WHERE [COLUMNS_1].[TABLE_NAME] = ? AND [COLUMNS_1].[TABLE_SCHEMA] = ? 2009-04-24 16:10:30,598 INFO sqlalchemy.engine.base.Engine.0x...6110 ['ACTIONS', u'dbo'] 2009-04-24 16:10:30,598 INFO sqlalchemy.engine.base.Engine.0x...6110 CREATE TABLE [ACTIONS] ( [ACTIONID] VARCHAR(48) NOT NULL, [TITLE] VARCHAR(128) NULL, [CMDLINE] VARCHAR(512) NULL, [STDIN] TEXT NULL, [STARTINDIR] VARCHAR(512) NULL, [PRIO] INTEGER NULL, PRIMARY KEY ([ACTIONID]) ) 2009-04-24 16:10:30,630 INFO sqlalchemy.engine.base.Engine.0x...6110 () 2009-04-24 16:10:30,661 INFO sqlalchemy.engine.base.Engine.0x...6110 COMMIT 2009-04-24 16:10:30,693 INFO sqlalchemy.engine.base.Engine.0x...6110 BEGIN 2009-04-24 16:10:30,707 INFO sqlalchemy.engine.base.Engine.0x...6110 INSERT INTO [ACTIONS] ([ACTIONID], [TITLE], [CMDLIN E], [STDIN], [STARTINDIR], [PRIO]) VALUES (?, ?, ?, ?, ?, ?) 2009-04-24 16:10:30,707 INFO sqlalchemy.engine.base.Engine.0x...6110 ['500', None, 'sol', None, None, None] 2009-04-24 16:10:30,723 INFO sqlalchemy.engine.base.Engine.0x...6110 COMMIT 2009-04-24 16:10:30,723 INFO sqlalchemy.engine.base.Engine.0x...6110 SELECT TOP 2 [ACTIONS].[ACTIONID] AS [ACTIONS_ACTIO NID], [ACTIONS].[TITLE] AS [ACTIONS_TITLE], [ACTIONS].[CMDLINE] AS [ACTIONS_CMDLINE], [ACTIONS].[STDIN] AS [ACTIONS_STDI N], [ACTIONS].[STARTINDIR] AS [ACTIONS_STARTINDIR], [ACTIONS].[PRIO] AS [ACTIONS_PRIO] FROM [ACTIONS] WHERE [ACTIONS].[ACTIONID] = ? 2009-04-24 16:10:30,740 INFO sqlalchemy.engine.base.Engine.0x...6110 ['500'] Michael Trier http://michaeltrier.com --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: pyodbc issues
Wow..your example worked for me. Could the kwargs the issue? On Fri, Apr 24, 2009 at 3:14 PM, mtrier mtr...@gmail.com wrote: On Apr 24, 2009, at 4:02 AM, Michael Mileusnich wrote: I have formated my PC with Vista 32. I also Installed SQL Server 2008 Express. Installed Python 2.6 and pyodbc...SAME ISSUE. I would be willing to have somebody overlook my python code. With echo on everything looks like it should be INSERTING. I've written this script based on the information you have supplied. It works fine for me: from sqlalchemy import * from sqlalchemy.orm import * engine = create_engine('mssql://sprint:spr...@localhost/sprint', echo=True) metadata = MetaData(engine) Session = scoped_session(sessionmaker(bind=engine, autoflush=False, autocommit=True)) action_table = Table( 'ACTIONS', metadata, Column('ACTIONID', String(48), primary_key=True), Column('TITLE', String(128)), Column('CMDLINE', String(512)), Column('STDIN', Text), Column('STARTINDIR', String(512)), Column('PRIO', Integer), ) class action(object): def __init__(self, ACTIONID, CMDLINE): self.ACTIONID = ACTIONID self.CMDLINE = CMDLINE def __repr__(self): return action('%s', '%s') % (self.ACTIONID, self.CMDLINE) mapper(action, action_table) metadata.create_all() session = Session() new_action = action(ACTIONID = '500', CMDLINE = 'sol') session.add(new_action) session.flush() session.expunge_all() act = session.query(action).filter_by(ACTIONID='500').one() assert new_action.ACTIONID == act.ACTIONID -- Would you please try it and let me know what results you get. The following is my output. S:\sqlalchemy.git\libpython msssqlprob.py 2009-04-24 16:10:30,473 INFO sqlalchemy.engine.base.Engine.0x...6110 SELECT user_name() as user_name; 2009-04-24 16:10:30,552 INFO sqlalchemy.engine.base.Engine.0x...6110 [] 2009-04-24 16:10:30,568 INFO sqlalchemy.engine.base.Engine.0x...6110 SELECT default_schema_name FROM sys.database_principals WHERE name = ? AND type = 'S' 2009-04-24 16:10:30,568 INFO sqlalchemy.engine.base.Engine.0x...6110 [u'dbo'] 2009-04-24 16:10:30,582 INFO sqlalchemy.engine.base.Engine.0x...6110 SELECT [COLUMNS_1].[TABLE_SCHEMA], [COLUMNS_1].[TAB LE_NAME], [COLUMNS_1].[COLUMN_NAME], [COLUMNS_1].[IS_NULLABLE], [COLUMNS_1].[DATA_TYPE], [COLUMNS_1].[ORDINAL_POSITION], [COLUMNS_1].[CHARACTER_MAXIMUM_LENGTH], [COLUMNS_1]. [NUMERIC_PRECISION], [COLUMNS_1].[NUMERIC_SCALE], [COLUMNS_1].[COLU MN_DEFAULT], [COLUMNS_1].[COLLATION_NAME] FROM [INFORMATION_SCHEMA].[COLUMNS] AS [COLUMNS_1] WHERE [COLUMNS_1].[TABLE_NAME] = ? AND [COLUMNS_1].[TABLE_SCHEMA] = ? 2009-04-24 16:10:30,598 INFO sqlalchemy.engine.base.Engine.0x...6110 ['ACTIONS', u'dbo'] 2009-04-24 16:10:30,598 INFO sqlalchemy.engine.base.Engine.0x...6110 CREATE TABLE [ACTIONS] ( [ACTIONID] VARCHAR(48) NOT NULL, [TITLE] VARCHAR(128) NULL, [CMDLINE] VARCHAR(512) NULL, [STDIN] TEXT NULL, [STARTINDIR] VARCHAR(512) NULL, [PRIO] INTEGER NULL, PRIMARY KEY ([ACTIONID]) ) 2009-04-24 16:10:30,630 INFO sqlalchemy.engine.base.Engine.0x...6110 () 2009-04-24 16:10:30,661 INFO sqlalchemy.engine.base.Engine.0x...6110 COMMIT 2009-04-24 16:10:30,693 INFO sqlalchemy.engine.base.Engine.0x...6110 BEGIN 2009-04-24 16:10:30,707 INFO sqlalchemy.engine.base.Engine.0x...6110 INSERT INTO [ACTIONS] ([ACTIONID], [TITLE], [CMDLIN E], [STDIN], [STARTINDIR], [PRIO]) VALUES (?, ?, ?, ?, ?, ?) 2009-04-24 16:10:30,707 INFO sqlalchemy.engine.base.Engine.0x...6110 ['500', None, 'sol', None, None, None] 2009-04-24 16:10:30,723 INFO sqlalchemy.engine.base.Engine.0x...6110 COMMIT 2009-04-24 16:10:30,723 INFO sqlalchemy.engine.base.Engine.0x...6110 SELECT TOP 2 [ACTIONS].[ACTIONID] AS [ACTIONS_ACTIO NID], [ACTIONS].[TITLE] AS [ACTIONS_TITLE], [ACTIONS].[CMDLINE] AS [ACTIONS_CMDLINE], [ACTIONS].[STDIN] AS [ACTIONS_STDI N], [ACTIONS].[STARTINDIR] AS [ACTIONS_STARTINDIR], [ACTIONS].[PRIO] AS [ACTIONS_PRIO] FROM [ACTIONS] WHERE [ACTIONS].[ACTIONID] = ? 2009-04-24 16:10:30,740 INFO sqlalchemy.engine.base.Engine.0x...6110 ['500'] Michael Trier http://michaeltrier.com --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: pyodbc issues
I tried reinstalled pyodbc many times. Still creates the tables just fine but no inserts. Am I doing this correctly: db.py contains: engine create scoped session table definitions mappers meta creates/delete each object has its own .py for example servers.py but contains no column information about that table. then I run a file which makes a server object, adds to session, flush... On Tue, Apr 21, 2009 at 10:42 AM, Michael Trier mtr...@gmail.com wrote: The trace looks fine to me. I'll try to test it myself tonight. Sent from mobile On Apr 20, 2009, at 10:45 PM, Michael Mileusnich justmike2...@gmail.com wrote: Any update on this? On Fri, Apr 17, 2009 at 6:07 PM, Michael Mileusnich justmike2...@gmail.com justmike2...@gmail.com wrote: Actually I made a mistake in running some of these py files manually. The tables exist now and this is what I receive: 2009-04-17 19:04:59,780 INFO sqlalchemy.engine.base.Engine.0x...1230 () 2009-04-17 19:04:59,796 INFO sqlalchemy.engine.base.Engine.0x...1230 COMMIT C:\Dev\pyschedpython createservers.py D:\Python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\databases\ms sql.py:977: DeprecationWarning: object.__new__() takes no parameters return super(MSSQLDialect, cls).__new__(cls, *args, **kwargs) 2009-04-17 19:05:07,203 INFO sqlalchemy.engine.base.Engine.0x...0270 BEGIN 2009-04-17 19:05:07,217 INFO sqlalchemy.engine.base.Engine.0x...0270 INSERT INTO [SERVERS] ([SERVER], [IP], [PORT], [OS], [JSERVER], [STARTED], [STDIN], [LOGIN] , [CWD], [ASSIGNEDONLY]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 2009-04-17 19:05:07,217 INFO sqlalchemy.engine.base.Engine.0x...0270 ['agent1', '192.168.0.100', 2000, 0, None, 1, 1, 1, 1, 0] 2009-04-17 19:05:07,217 INFO sqlalchemy.engine.base.Engine.0x...0270 COMMIT On Fri, Apr 17, 2009 at 5:58 PM, Michael Trier mtr...@gmail.com mtr...@gmail.com wrote: The SERVERS table doesn't exist according to the trace. Did you create your tables? Sent from mobile On Apr 17, 2009, at 7:31 PM, Michael Mileusnich justmike2...@gmail.com justmike2...@gmail.com wrote: C:\Dev\pyschedpython createservers.py D:\Python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\databases\ms sql.py:977: DeprecationWarning: object.__new__() takes no parameters return super(MSSQLDialect, cls).__new__(cls, *args, **kwargs) 2009-04-17 18:29:10,421 INFO sqlalchemy.engine.base.Engine.0x...0270 BEGIN 2009-04-17 18:29:10,437 INFO sqlalchemy.engine.base.Engine.0x...0270 INSERT INTO [SERVERS] ([SERVER], [IP], [PORT], [OS], [JSERVER], [STARTED], [STDIN], [LOGIN] , [CWD], [ASSIGNEDONLY]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 2009-04-17 18:29:10,437 INFO sqlalchemy.engine.base.Engine.0x...0270 ['agent1', '192.168.0.100', 2000, 0, None, 1, 1, 1, 1, 0] 2009-04-17 18:29:10,500 INFO sqlalchemy.engine.base.Engine.0x...0270 ROLLBACK Traceback (most recent call last): File createservers.py, line 9, in module session.flush() File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ session.py, line 1351, in flush self._flush(objects) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ session.py, line 1422, in _flush flush_context.execute() File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ unitofwork.py, line 244, in execute UOWExecutor().execute(self, tasks) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ unitofwork.py, line 707, in execute self.execute_save_steps(trans, task) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ unitofwork.py, line 722, in execute_save_steps self.save_objects(trans, task) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ unitofwork.py, line 713, in save_objects task.mapper._save_obj(task.polymorphic_tosave_objects, trans) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ mapper.py, line 1347, in _save_obj c = connection.execute(statement.values(value_params), params) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\engi ne\base.py, line 824, in execute return Connection.executors[c](self, object, multiparams, params) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\engi ne\base.py, line 874, in _execute_clauseelement return self.__execute_context(context) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\engi ne\base.py, line 896, in __execute_context self._cursor_execute(context.cursor, context.statement, context.parameters[0 ], context=context) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\engi ne\base.py, line 950, in _cursor_execute self._handle_dbapi_exception(e, statement, parameters, cursor, context) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6
[sqlalchemy] Re: pyodbc issues
Any update on this? On Fri, Apr 17, 2009 at 6:07 PM, Michael Mileusnich justmike2...@gmail.comwrote: Actually I made a mistake in running some of these py files manually. The tables exist now and this is what I receive: 2009-04-17 19:04:59,780 INFO sqlalchemy.engine.base.Engine.0x...1230 () 2009-04-17 19:04:59,796 INFO sqlalchemy.engine.base.Engine.0x...1230 COMMIT C:\Dev\pyschedpython createservers.py D:\Python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\databases\ms sql.py:977: DeprecationWarning: object.__new__() takes no parameters return super(MSSQLDialect, cls).__new__(cls, *args, **kwargs) 2009-04-17 19:05:07,203 INFO sqlalchemy.engine.base.Engine.0x...0270 BEGIN 2009-04-17 19:05:07,217 INFO sqlalchemy.engine.base.Engine.0x...0270 INSERT INTO [SERVERS] ([SERVER], [IP], [PORT], [OS], [JSERVER], [STARTED], [STDIN], [LOGIN] , [CWD], [ASSIGNEDONLY]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 2009-04-17 19:05:07,217 INFO sqlalchemy.engine.base.Engine.0x...0270 ['agent1', '192.168.0.100', 2000, 0, None, 1, 1, 1, 1, 0] 2009-04-17 19:05:07,217 INFO sqlalchemy.engine.base.Engine.0x...0270 COMMIT On Fri, Apr 17, 2009 at 5:58 PM, Michael Trier mtr...@gmail.com wrote: The SERVERS table doesn't exist according to the trace. Did you create your tables? Sent from mobile On Apr 17, 2009, at 7:31 PM, Michael Mileusnich justmike2...@gmail.com wrote: C:\Dev\pyschedpython createservers.py D:\Python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\databases\ms sql.py:977: DeprecationWarning: object.__new__() takes no parameters return super(MSSQLDialect, cls).__new__(cls, *args, **kwargs) 2009-04-17 18:29:10,421 INFO sqlalchemy.engine.base.Engine.0x...0270 BEGIN 2009-04-17 18:29:10,437 INFO sqlalchemy.engine.base.Engine.0x...0270 INSERT INTO [SERVERS] ([SERVER], [IP], [PORT], [OS], [JSERVER], [STARTED], [STDIN], [LOGIN] , [CWD], [ASSIGNEDONLY]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 2009-04-17 18:29:10,437 INFO sqlalchemy.engine.base.Engine.0x...0270 ['agent1', '192.168.0.100', 2000, 0, None, 1, 1, 1, 1, 0] 2009-04-17 18:29:10,500 INFO sqlalchemy.engine.base.Engine.0x...0270 ROLLBACK Traceback (most recent call last): File createservers.py, line 9, in module session.flush() File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ session.py, line 1351, in flush self._flush(objects) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ session.py, line 1422, in _flush flush_context.execute() File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ unitofwork.py, line 244, in execute UOWExecutor().execute(self, tasks) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ unitofwork.py, line 707, in execute self.execute_save_steps(trans, task) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ unitofwork.py, line 722, in execute_save_steps self.save_objects(trans, task) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ unitofwork.py, line 713, in save_objects task.mapper._save_obj(task.polymorphic_tosave_objects, trans) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ mapper.py, line 1347, in _save_obj c = connection.execute(statement.values(value_params), params) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\engi ne\base.py, line 824, in execute return Connection.executors[c](self, object, multiparams, params) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\engi ne\base.py, line 874, in _execute_clauseelement return self.__execute_context(context) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\engi ne\base.py, line 896, in __execute_context self._cursor_execute(context.cursor, context.statement, context.parameters[0 ], context=context) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\engi ne\base.py, line 950, in _cursor_execute self._handle_dbapi_exception(e, statement, parameters, cursor, context) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\engi ne\base.py, line 931, in _handle_dbapi_exception raise exc.DBAPIError.instance(statement, parameters, e, connection_invalidat ed=is_disconnect) sqlalchemy.exc.ProgrammingError: (ProgrammingError) ('42S02', [42S02] [Microsof t][ODBC SQL Server Driver][SQL Server]Invalid object name 'SERVERS'. (208) (SQLE xecDirectW); [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared. (8180)) u'INSERT INTO [SERVERS] ([SERVER], [IP], [PORT] , [OS], [JSERVER], [STARTED], [STDIN], [LOGIN], [CWD], [ASSIGNEDONLY]) VALUES (? , ?, ?, ?, ?, ?, ?, ?, ?, ?)' ['agent1', '192.168.0.100', 2000, 0, None, 1, 1, 1 , 1, 0] C:\Dev\pysched On Fri, Apr
[sqlalchemy] pyodbc issues
I am still having issues with pyodbc on Python 2.6. Platform: Windows XP SP3 32 bit Python 2.6 SQLAlchemy 0.5.3 pyodbc 2.1.3 When I use SQL-Lite, my tables are created and all my data is inserted. When I use MS SQL, the tables get created but my data will not insert. Here is my session: Session = scoped_session(sessionmaker(bind=engine, autoflush=False, autocommit=True)) Any ideas? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: pyodbc issues
I do not recall having installed FreeTDS. On Fri, Apr 17, 2009 at 9:56 AM, Michael Bayer mike...@zzzcomputing.comwrote: are you using FreeTDS ? there's a known issue with FreeTDS and SQLA 0.5. Michael Mileusnich wrote: I am still having issues with pyodbc on Python 2.6. Platform: Windows XP SP3 32 bit Python 2.6 SQLAlchemy 0.5.3 pyodbc 2.1.3 When I use SQL-Lite, my tables are created and all my data is inserted. When I use MS SQL, the tables get created but my data will not insert. Here is my session: Session = scoped_session(sessionmaker(bind=engine, autoflush=False, autocommit=True)) Any ideas? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: pyodbc issues
I add my object to the session and flush. No insert happens. Works fine with SQL-LIte. I have have tried adding a commit also but that does not help. On Fri, Apr 17, 2009 at 10:02 AM, Michael Bayer mike...@zzzcomputing.comwrote: can you be more specific what will not insert means. Michael Mileusnich wrote: I do not recall having installed FreeTDS. On Fri, Apr 17, 2009 at 9:56 AM, Michael Bayer mike...@zzzcomputing.comwrote: are you using FreeTDS ? there's a known issue with FreeTDS and SQLA 0.5. Michael Mileusnich wrote: I am still having issues with pyodbc on Python 2.6. Platform: Windows XP SP3 32 bit Python 2.6 SQLAlchemy 0.5.3 pyodbc 2.1.3 When I use SQL-Lite, my tables are created and all my data is inserted. When I use MS SQL, the tables get created but my data will not insert. Here is my session: Session = scoped_session(sessionmaker(bind=engine, autoflush=False, autocommit=True)) Any ideas? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: pyodbc issues
Actually I made a mistake in running some of these py files manually. The tables exist now and this is what I receive: 2009-04-17 19:04:59,780 INFO sqlalchemy.engine.base.Engine.0x...1230 () 2009-04-17 19:04:59,796 INFO sqlalchemy.engine.base.Engine.0x...1230 COMMIT C:\Dev\pyschedpython createservers.py D:\Python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\databases\ms sql.py:977: DeprecationWarning: object.__new__() takes no parameters return super(MSSQLDialect, cls).__new__(cls, *args, **kwargs) 2009-04-17 19:05:07,203 INFO sqlalchemy.engine.base.Engine.0x...0270 BEGIN 2009-04-17 19:05:07,217 INFO sqlalchemy.engine.base.Engine.0x...0270 INSERT INTO [SERVERS] ([SERVER], [IP], [PORT], [OS], [JSERVER], [STARTED], [STDIN], [LOGIN] , [CWD], [ASSIGNEDONLY]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 2009-04-17 19:05:07,217 INFO sqlalchemy.engine.base.Engine.0x...0270 ['agent1', '192.168.0.100', 2000, 0, None, 1, 1, 1, 1, 0] 2009-04-17 19:05:07,217 INFO sqlalchemy.engine.base.Engine.0x...0270 COMMIT On Fri, Apr 17, 2009 at 5:58 PM, Michael Trier mtr...@gmail.com wrote: The SERVERS table doesn't exist according to the trace. Did you create your tables? Sent from mobile On Apr 17, 2009, at 7:31 PM, Michael Mileusnich justmike2...@gmail.com wrote: C:\Dev\pyschedpython createservers.py D:\Python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\databases\ms sql.py:977: DeprecationWarning: object.__new__() takes no parameters return super(MSSQLDialect, cls).__new__(cls, *args, **kwargs) 2009-04-17 18:29:10,421 INFO sqlalchemy.engine.base.Engine.0x...0270 BEGIN 2009-04-17 18:29:10,437 INFO sqlalchemy.engine.base.Engine.0x...0270 INSERT INTO [SERVERS] ([SERVER], [IP], [PORT], [OS], [JSERVER], [STARTED], [STDIN], [LOGIN] , [CWD], [ASSIGNEDONLY]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 2009-04-17 18:29:10,437 INFO sqlalchemy.engine.base.Engine.0x...0270 ['agent1', '192.168.0.100', 2000, 0, None, 1, 1, 1, 1, 0] 2009-04-17 18:29:10,500 INFO sqlalchemy.engine.base.Engine.0x...0270 ROLLBACK Traceback (most recent call last): File createservers.py, line 9, in module session.flush() File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ session.py, line 1351, in flush self._flush(objects) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ session.py, line 1422, in _flush flush_context.execute() File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ unitofwork.py, line 244, in execute UOWExecutor().execute(self, tasks) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ unitofwork.py, line 707, in execute self.execute_save_steps(trans, task) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ unitofwork.py, line 722, in execute_save_steps self.save_objects(trans, task) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ unitofwork.py, line 713, in save_objects task.mapper._save_obj(task.polymorphic_tosave_objects, trans) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\orm\ mapper.py, line 1347, in _save_obj c = connection.execute(statement.values(value_params), params) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\engi ne\base.py, line 824, in execute return Connection.executors[c](self, object, multiparams, params) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\engi ne\base.py, line 874, in _execute_clauseelement return self.__execute_context(context) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\engi ne\base.py, line 896, in __execute_context self._cursor_execute(context.cursor, context.statement, context.parameters[0 ], context=context) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\engi ne\base.py, line 950, in _cursor_execute self._handle_dbapi_exception(e, statement, parameters, cursor, context) File d:\python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\engi ne\base.py, line 931, in _handle_dbapi_exception raise exc.DBAPIError.instance(statement, parameters, e, connection_invalidat ed=is_disconnect) sqlalchemy.exc.ProgrammingError: (ProgrammingError) ('42S02', [42S02] [Microsof t][ODBC SQL Server Driver][SQL Server]Invalid object name 'SERVERS'. (208) (SQLE xecDirectW); [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared. (8180)) u'INSERT INTO [SERVERS] ([SERVER], [IP], [PORT] , [OS], [JSERVER], [STARTED], [STDIN], [LOGIN], [CWD], [ASSIGNEDONLY]) VALUES (? , ?, ?, ?, ?, ?, ?, ?, ?, ?)' ['agent1', '192.168.0.100', 2000, 0, None, 1, 1, 1 , 1, 0] C:\Dev\pysched On Fri, Apr 17, 2009 at 5:05 PM, Michael Trier mtr...@gmail.com mtr...@gmail.com wrote: On Apr 17, 2009, at 5:46 PM, Michael
[sqlalchemy] SA and python 26
I have been working with Python 2.5 and SQLAlchemy. I recently upgraded to Python 2.6 on my Windows machine and I receive the following message: D:\Python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy\databases\ms sql.py:977: DeprecationWarning: object.__new__() takes no parameters return super(MSSQLDialect, cls).__new__(cls, *args, **kwargs) I have a script that creates my tables and inserts data. The tables get created however they are empty. Here is some example code that does not work: from sqlalchemy.orm import * from db import * session = getsession() new_serv = server(SERVER = test) session.add(new_serv) session.flush() --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: SA and python 26
The code used to work in 2.5. A simple add and flush was all I needed to do. I tried to use a commit but that did not work either. Am I missing something here? On Sun, Apr 5, 2009 at 4:58 PM, Michael Bayer mike...@zzzcomputing.comwrote: this is not an error, it is only a warning.There should be no difference in behavior between py2.5 and 2.6. The code you have below may not necessarily create any data if you didn't commit your transaction. On Apr 5, 2009, at 6:05 PM, Michael Mileusnich wrote: I have been working with Python 2.5 and SQLAlchemy. I recently upgraded to Python 2.6 on my Windows machine and I receive the following message: D:\Python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy \databases\ms sql.py:977: DeprecationWarning: object.__new__() takes no parameters return super(MSSQLDialect, cls).__new__(cls, *args, **kwargs) I have a script that creates my tables and inserts data. The tables get created however they are empty. Here is some example code that does not work: from sqlalchemy.orm import * from db import * session = getsession() new_serv = server(SERVER = test) session.add(new_serv) session.flush() --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: SA and python 26
I tried to the same py scripts with sqllite and that works fine. The issues seems to be with pyodbc however I am using the version from the site. http://code.google.com/p/pyodbc/downloads/detail?name=pyodbc-2.1.3.win32-py2.6.execan=2q= My db.py file has all my tables and mappers in it and the columns are defined there and not in the classes. here is my engine/session stuff: engine = create_engine(connection) metadata = MetaData(engine) Session = scoped_session(sessionmaker(bind=engine, autoflush=False, autocommit=True)) On Sun, Apr 5, 2009 at 10:31 PM, Michael Trier mtr...@gmail.com wrote: On Sun, Apr 5, 2009 at 9:46 PM, Michael Bayer mike...@zzzcomputing.comwrote: and i would also suggest investigating if the DBAPI you're using is somehow different than the one you've used with 2.5, or unsupported on py2.6. On Apr 5, 2009, at 7:59 PM, Michael Mileusnich wrote: The code used to work in 2.5. A simple add and flush was all I needed to do. I tried to use a commit but that did not work either. Am I missing something here? On Sun, Apr 5, 2009 at 4:58 PM, Michael Bayer mike...@zzzcomputing.comwrote: this is not an error, it is only a warning.There should be no difference in behavior between py2.5 and 2.6. The code you have below may not necessarily create any data if you didn't commit your transaction. On Apr 5, 2009, at 6:05 PM, Michael Mileusnich wrote: I have been working with Python 2.5 and SQLAlchemy. I recently upgraded to Python 2.6 on my Windows machine and I receive the following message: D:\Python26\lib\site-packages\sqlalchemy-0.5.3-py2.6.egg\sqlalchemy \databases\ms sql.py:977: DeprecationWarning: object.__new__() takes no parameters return super(MSSQLDialect, cls).__new__(cls, *args, **kwargs) I have a script that creates my tables and inserts data. The tables get created however they are empty. Here is some example code that does not work: from sqlalchemy.orm import * from db import * session = getsession() new_serv = server(SERVER = test) session.add(new_serv) session.flush() I'm using the latest pyodbc with 2.6.1 version of python and all tests run fine. If you provide a test script I can dig into it. -- Michael Trier http://blog.michaeltrier.com/ http://thisweekindjango.com/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: POSTGRE Error with scoped sessions.
Ok, was just curious if anyone else had this error. On Wed, Jan 7, 2009 at 7:52 PM, Michael Bayer mike...@zzzcomputing.comwrote: That doesnt appear to be within SQLAlchemy. This might just be too much load for psycopg2 / your Python interpreter ?There's not much else to suggest here without a lot more context. On Jan 7, 2009, at 8:17 PM, Michael Mileusnich wrote: Hello, I am writing some code using SQLAlchemy and have been testing that code against a number of databases. Everything seems to work except in POSTGRE. This is a threaded app and I use a scoped session. When the app spawns under ~20 threads everything seems cool but when the app spawns more than ~20 I get the following error: Assertion failed: (gc-gc.gc_refs != 0), function update_refs, file Modules/gcmodule.c, line 261. Abort trap --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: ORM relations...
I am not sure based on the project if I can have a module that imports both of them. How can I use the string based ForeignKey? I may be doing it in correctly because it says the table does not exist that I try to reference. On Tue, Dec 23, 2008 at 12:18 PM, Michael Bayer mike...@zzzcomputing.comwrote: ForeignKey accepts strings to remove the inconvenience of handling circular imports. Both dependent tables will need to be present within the shared MetaData object at the point at which the Table object is first used, though, so another module that imports both queue and filequeue would be best. On Dec 23, 2008, at 10:48 AM, justmike2...@gmail.com wrote: Over the last couple days I have been having an issue with relations/ imports. I have a class called queue where I define all my columns. Within queue I have a function that references a class filequeue so I need to 'from filequeues import filequeue'. The queue class itself has relations with other classes/tables. My problem is that within filequeue, I need to 'from queues import queue' in order to ForeignKey (queue.queueid). Well now queue imports filequeue and filequeue imports queue causing an issue. I tried to ForeignKey ('QUEUES.queueid') but SQLAlch says it cannot find the tables. Any ideas? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: ORM relations...
I have a py file that creates my tables. It does MetaData = queue.metadata. metadata.create_all(). That's all I do with MetaData. Is there additional table setup I need to be doing? On Tue, Dec 23, 2008 at 12:24 PM, Michael Bayer mike...@zzzcomputing.comwrote: thats because both Table objects need to be present in the MetaData when used. Ultimately your application can't run unless both queue and filequeue have been imported in some way. On Dec 23, 2008, at 1:21 PM, Michael Mileusnich wrote: I am not sure based on the project if I can have a module that imports both of them. How can I use the string based ForeignKey? I may be doing it in correctly because it says the table does not exist that I try to reference. On Tue, Dec 23, 2008 at 12:18 PM, Michael Bayer mike...@zzzcomputing.comwrote: ForeignKey accepts strings to remove the inconvenience of handling circular imports. Both dependent tables will need to be present within the shared MetaData object at the point at which the Table object is first used, though, so another module that imports both queue and filequeue would be best. On Dec 23, 2008, at 10:48 AM, justmike2...@gmail.com wrote: Over the last couple days I have been having an issue with relations/ imports. I have a class called queue where I define all my columns. Within queue I have a function that references a class filequeue so I need to 'from filequeues import filequeue'. The queue class itself has relations with other classes/tables. My problem is that within filequeue, I need to 'from queues import queue' in order to ForeignKey (queue.queueid). Well now queue imports filequeue and filequeue imports queue causing an issue. I tried to ForeignKey ('QUEUES.queueid') but SQLAlch says it cannot find the tables. Any ideas? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: cascade
Yea I do the ondelete and onupdate in ForeignKey, creates tables and all but does not do the cascade or at least not in MSSQL. On Tue, Dec 23, 2008 at 7:42 PM, justmike2...@gmail.com justmike2...@gmail.com wrote: I seem to be running into a problem with implementing cascades in sqlalch. Next to my ForeignKey() I have ondelete and onupdate both set to CASCADE and in my mapper I have this: mapper(queue, queue_table, properties=dict(parent=relation(queue, backref='JOBS'))) However the cascade is not being listed in MSSQL. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: cascade
code: queue_table = Table( 'QUEUES', metadata, Column('QUEUEID', Integer, autoincrement=True, primary_key=True), Column('JOBNUM', String(48), ForeignKey('JOBS.JOBNUM', onupdate=CASCADE, ondelete=CASCADE)), Column('SCHEDID', String(48), ForeignKey('SCHEDULES.SCHEDID')), Column('DATE', DateTime), Column('STATUS', Integer)) # 0 sched 1 Ignore 2 Evalling 3 Running 4 Unsched 5 Error mapper(queue, queue_table, properties=dict(parent=relation(queue, backref='job'))) In MSSQL the cascade entries for those tables are set to none and my app also generate this: many-to-many relation, 'secondaryjoin' is needed as well. % (self)) sqlalchemy.exc.ArgumentError: Could not determine join condition between parent/ child tables on relation queue.parent. Specify a 'primaryjoin' expression. If this is a many-to-many relation, 'secondaryjoin' is needed as well. On Tue, Dec 23, 2008 at 10:52 PM, Michael Bayer mike...@zzzcomputing.comwrote: generates the ON DELETE CASCADE in the DDL, versus the cascade does not work, are two different issues. Which are you experiencing, and if the latter, how is the issue manifesting itself ? Can you produce sample code which reproduces your issue ? On Dec 23, 2008, at 10:19 PM, Michael Mileusnich wrote: Yea I do the ondelete and onupdate in ForeignKey, creates tables and all but does not do the cascade or at least not in MSSQL. On Tue, Dec 23, 2008 at 7:42 PM, justmike2...@gmail.com justmike2...@gmail.com wrote: I seem to be running into a problem with implementing cascades in sqlalch. Next to my ForeignKey() I have ondelete and onupdate both set to CASCADE and in my mapper I have this: mapper(queue, queue_table, properties=dict(parent=relation(queue, backref='JOBS'))) However the cascade is not being listed in MSSQL. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---