Oops, make that:
MSSQLDialect.do_begin = lambda self, conn: None

(pass is not allowed in lambda statements ;-) I had already corrected
the mistake in my code, only to make it again posting the message,
sorry...)

On 27 apr, 22:33, polaar <steven.vereec...@gmail.com> 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\lib>python 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to