python Programming Glossary: self.cursor
PostgreSQL - how to run VACUUM from code outside transaction block? http://stackoverflow.com/questions/1017463/postgresql-how-to-run-vacuum-from-code-outside-transaction-block s user s password s dbname host port user password self.cursor self.conn.cursor def _doQuery self query self.cursor.execute.. self.cursor self.conn.cursor def _doQuery self query self.cursor.execute query self.conn.commit def vacuum self query VACUUM..
sqlalchemy cursor error during yield_per http://stackoverflow.com/questions/12233115/sqlalchemy-cursor-error-during-yield-per Item .yield_per 10 fetch cursor.fetchmany self._yield_per self.cursor self.context l self.process_rows self._fetchmany_impl size row.. self.__buffer_rows self.__rowbuffer collections.deque self.cursor.fetchmany size sqlalchemy.exc.ProgrammingError ProgrammingError..
Gracefully handling “MySQL has gone away” http://stackoverflow.com/questions/1987701/gracefully-handling-mysql-has-gone-away try this. Here's my code def select self query params try self.cursor self.cxn.cursor self.cursor.execute query params except MySQLdb.OperationalError.. select self query params try self.cursor self.cxn.cursor self.cursor.execute query params except MySQLdb.OperationalError e if e.. print self.cxn self.cxn.close self.cxn self.db._get_cxn self.cursor self.cxn.cursor self.cursor.execute query params print self.cxn..
cx_Oracle and Exception Handling - Good practices? http://stackoverflow.com/questions/7465889/cx-oracle-and-exception-handling-good-practices succeeded create the cursor # we re going to use. self.cursor db.Cursor def disconnect self Disconnect from the database... instance doesn't exist we don't really care. try self.cursor.close self.db.close except cx_Oracle.DatabaseError pass def.. is a dictionary of variables you pass to execute. try self.cursor.execute sql bindvars except cx_Oracle.DatabaseError as e error..
Context manager for Python's MySQLdb http://stackoverflow.com/questions/8067690/context-manager-for-pythons-mysqldb passwd config.PASS dbname config.MYDB driver MySQLdb self.cursorclass cursorclass self.host host self.user user self.passwd passwd.. user user passwd passwd db dbname cursorclass cursorclass self.cursor self.connection.cursor def __iter__ self for item in self.cursor.. self.connection.cursor def __iter__ self for item in self.cursor yield item def __enter__ self return self.cursor def __exit__..
Creating a logging handler to connect to Oracle? http://stackoverflow.com/questions/935930/creating-a-logging-handler-to-connect-to-oracle s' lineno d msecs d ' exc_text s' ' thread s' self.cursor self.conn.cursor def formatDBTime self record record.dbtime.. else record.exc_text sql self.SQL record.__dict__ self.cursor.execute sql self.conn.commit except import traceback ei sys.exc_info.. ei 0 ei 1 ei 2 None sys.stderr del ei def close self self.cursor.close self.conn.close logging.Handler.close self dh DBHandler..
|