yes On Fri, Apr 24, 2009 at 8:47 AM, Michael Bayer <[email protected]>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. > > > and issuing COMMIT ? > > > > > > On Wed, Apr 22, 2009 at 1:40 AM, Michael Mileusnich < > [email protected]> 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 <[email protected]> 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 <[email protected]> >>> wrote: >>> >>> Any update on this? >>> >>> On Fri, Apr 17, 2009 at 6:07 PM, Michael Mileusnich >>> <<[email protected]> >>> [email protected]> 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\pysched>python 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 < <[email protected]> >>>> [email protected]> 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 <<[email protected]> >>>>> [email protected]> wrote: >>>>> >>>>> C:\Dev\pysched>python 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 < >>>>> <[email protected]><[email protected]> >>>>> [email protected]> wrote: >>>>> >>>>>> >>>>>> On Apr 17, 2009, at 5:46 PM, Michael Mileusnich >>>>>> <<[email protected]><[email protected]> >>>>>> [email protected]> wrote: >>>>>> >>>>>> First, thanks for being patient and assisting me. I am very >>>>>> thankful. >>>>>> >>>>>> MS SQL 2005 is the db I am running. >>>>>> >>>>>> part of my db.py script: >>>>>> >>>>>> try: >>>>>> connection = config.get("db", "connection") >>>>>> except: >>>>>> print "No Database Specified" >>>>>> sys.exit(1) >>>>>> >>>>>> engine = create_engine(connection) >>>>>> >>>>>> 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), >>>>>> Column('USERID', Integer, ForeignKey('USERS.USERID'))) >>>>>> >>>>>> ... >>>>>> more tables here >>>>>> ... >>>>>> etc >>>>>> >>>>>> mapper(action, action_table) >>>>>> >>>>>> here is my create: >>>>>> >>>>>> new_action = action(ACTIONID = '500', CMDLINE = 'sol') >>>>>> session.add(new_action) >>>>>> session.flush() >>>>>> >>>>>> also how do I turn on echo? >>>>>> >>>>>> On Fri, Apr 17, 2009 at 3:24 PM, Michael Trier < >>>>>> <[email protected]><[email protected]><[email protected]> >>>>>> [email protected]> wrote: >>>>>> >>>>>>> On Fri, Apr 17, 2009 at 2:01 AM, Michael Mileusnich >>>>>>> <<[email protected]><[email protected]><[email protected]> >>>>>>> [email protected]> 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 >>>>>>>> >>>>>>>> I run this exact setup without problems. Maybe if we see the script >>>>>>> that will help. What version of MSSQL? >>>>>>> >>>>>>>> -- >>>>>>>> Michael Trier >>>>>>>> <http://blog.michaeltrier.com/> >>>>>>>> <http://blog.michaeltrier.com/><http://blog.michaeltrier.com/> >>>>>>>> http://blog.michaeltrier.com/ >>>>>>>> <http://thisweekindjango.com/> >>>>>>>> <http://thisweekindjango/><http://thisweekindjango/> >>>>>>>> http://thisweekindjango. >>>>>>> >>>>>>> >>>>>> engine = create_engine(connection, echo=True) >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>> >>> >>> >>> >>> >>> >>> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
