[sqlalchemy] Re: Error after upgrade from 0.4.3 to 0.4.6
Hi, I've done some exploring and found that if I connect to the database as the schema owner the error goes away. I had been connecting through a proxy account and this was working fine in 4.3. You can see where this is tripping up 4.6 from the sql log just after staring the app: With 4.6: C:\Documents and Settings\daystev\Desktop\asrt_trunk\srt-projectstart- srt.py dev.cfg SELECT USER FROM DUAL {} select COLUMN_NAME, DATA_TYPE, DATA_LENGTH, DATA_PRECISION, DATA_SCALE, NULLABLE , DATA_DEFAULT from ALL_TAB_COLUMNS where TABLE_NAME = :table_name and OWNER = : owner {'owner': 'ASRT_PROXY', 'table_name': 'ACC_PROTOCOL'} Traceback (most recent call last): File C:\Documents and Settings\daystev\Desktop\asrt_trunk\srt- project\start-srt.py, line 24, in module ... With 4.3: C:\Documents and Settings\daystev\Desktop\asrt_trunk\srt-projectstart- srt.py dev.cfg SELECT USER FROM DUAL {} select COLUMN_NAME, DATA_TYPE, DATA_LENGTH, DATA_PRECISION, DATA_SCALE, NULLABLE , DATA_DEFAULT from ALL_TAB_COLUMNS where TABLE_NAME = :table_name and OWNER = : owner {'owner': 'ASRT_PROXY', 'table_name': 'ACC_PROTOCOL'} Traceback (most recent call last): File C:\Documents and Settings\daystev\Desktop\asrt_trunk\srt- project\start-srt.py, line 24, in module ... Note that 4.6 is using ASRT_PROXY as the owner while 4.3 uses ASRT (the actual owner). To fix the problem (and continue using the proxy account) I added schema=ASRT to all my table definitions. Now everything works fine. Thanks for all your work. Congrats on the book(s)! Steve On Jul 18, 1:45 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Jul 18, 2008, at 1:32 PM, shday wrote: I upgraded from 0.4.3 to 0.4.6 and now I get the error below when starting my TurboGears app. I'm using reflection and that fails on the first table. I had a look at the changelog and tried adding oracle_resolve_synonyms=True to that table's definition but I got another error (not shown here). Any help would be appreciated. what's the schema look like ? are synonyms in use ? are there cross- owner names in use ? what's the error you got with oracle_resolve_synonyms ? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Error after upgrade from 0.4.3 to 0.4.6
I upgraded from 0.4.3 to 0.4.6 and now I get the error below when starting my TurboGears app. I'm using reflection and that fails on the first table. I had a look at the changelog and tried adding oracle_resolve_synonyms=True to that table's definition but I got another error (not shown here). Any help would be appreciated. Thanks, Steve C:\Documents and Settings\daystev\Desktop\asrt_trunk\srt-projectstart- srt.py de v.cfg SELECT USER FROM DUAL {} select COLUMN_NAME, DATA_TYPE, DATA_LENGTH, DATA_PRECISION, DATA_SCALE, NULLABLE , DATA_DEFAULT from ALL_TAB_COLUMNS where TABLE_NAME = :table_name and OWNER = : owner {'owner': 'ASRT_PROXY', 'table_name': 'ACC_PROTOCOL'} Traceback (most recent call last): File C:\Documents and Settings\daystev\Desktop\asrt_trunk\srt- project\start-s rt.py, line 24, in module from srt.controllers import Root File C:\Documents and Settings\daystev\Desktop\asrt_trunk\srt- project\srt\con trollers.py, line 6, in module import model as dbmodel File C:\Documents and Settings\daystev\Desktop\asrt_trunk\srt- project\srt\mod el.py, line 27, in module autoload=True) File c:\python25\lib\site-packages\sqlalchemy-0.4.6-py2.5.egg \sqlalchemy\sche ma.py, line 110, in __call__ return type.__call__(self, name, metadata, *args, **kwargs) File c:\python25\lib\site-packages\sqlalchemy-0.4.6-py2.5.egg \sqlalchemy\sche ma.py, line 226, in __init__ _bind_or_error(metadata).reflecttable(self, include_columns=include_columns) File c:\python25\lib\site-packages\sqlalchemy-0.4.6-py2.5.egg \sqlalchemy\engi ne\base.py, line 1275, in reflecttable self.dialect.reflecttable(conn, table, include_columns) File c:\python25\lib\site-packages\sqlalchemy-0.4.6-py2.5.egg \sqlalchemy\data bases\oracle.py, line 501, in reflecttable raise exceptions.AssertionError(Couldn't find any column information for ta ble %s % actual_name) sqlalchemy.exceptions.AssertionError: Couldn't find any column information for t able ACC_PROTOCOL --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: SQLAlchemy 0.4.3 Released
try: easy_install --upgrade SQLAlchemy No need to uninstall. http://peak.telecommunity.com/DevCenter/EasyInstall#upgrading-a-package On Feb 15, 7:39 pm, maxi [EMAIL PROTECTED] wrote: Great Job !!! How can I upgrade from 0.4.2p3 ? (Or I have to uninstall all previous version?) Regards. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: Read only connection with Table reflection
Is there any way to use reflection with a read only connection? I use reflection on an Oracle database with read only permission, no problems (using SA 0.3.8). I don't recall seeing SA trying to do a ROLLBACK during reflection though. Steve --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: sqlalchemy exceptions
Forgive the dumb question, but what is the proper SQLAlchemy recommended way to deal with a situation like this. Should I see if the object already exists first, or be lazy and try to write to the database and attempt to catch the exception. Good question. Personally I think that this Exception is common enough that you should check for it rather than catch it. But if you stick with what you have, I believe you will catch the error by adding something like this in your try statement: session.save(u) session.flush() I love to read, so if you can point me to some examples on situations like this it would be very helpful. Not sure if this is what you mean, but here is a very good SA tutorial: http://www.rmunn.com/sqlalchemy-tutorial/tutorial.html --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] SQLError: ... invalid identifier
I am getting a new error when using r2607. When I switch back to 3.6 there is no error. Here is the stack trace: Page handler: bound method StudyRequestController.default of srt.controllers.StudyRequestController instance at 0x015D6620 Traceback (most recent call last): File C:\Python24\lib\site-packages\cherrypy-2.2.1-py2.4.egg\cherrypy \_cphttptools.py, line 105, in _run self.main() File C:\Python24\lib\site-packages\cherrypy-2.2.1-py2.4.egg\cherrypy \_cphttptools.py, line 254, in main body = page_handler(*virtual_path, **self.params) File string, line 3, in default File C:\Documents and Settings\Stephen\Desktop\tg_checkout \turbogears\controllers.py, line 334, in expose File string, line 5, in run_with_transaction File c:\documents and settings\daystev\desktop\tg_checkout \turbogears\database.py, line 354, in sa_rwt retval = dispatch_exception(e,args,kw) File c:\documents and settings\daystev\desktop\tg_checkout \turbogears\database.py, line 343, in sa_rwt retval = func(*args, **kw) File string, line 5, in _expose File C:\Documents and Settings\Stephen\Desktop\tg_checkout \turbogears\controllers.py, line 351, in lambda File C:\Documents and Settings\Stephen\Desktop\tg_checkout \turbogears\controllers.py, line 378, in _execute_func File C:\Documents and Settings\Stephen\Desktop\tg_checkout \turbogears\errorhandling.py, line 73, in try_call File C:\Documents and Settings\Daystev\Desktop\srt_trunk\srt-project \srt\controllers.py, line 232, in default return action(item, **params) File string, line 3, in edit File C:\Documents and Settings\Stephen\Desktop\tg_checkout \turbogears\controllers.py, line 330, in expose File string, line 5, in _expose File C:\Documents and Settings\Stephen\Desktop\tg_checkout \turbogears\controllers.py, line 351, in lambda File C:\Documents and Settings\Stephen\Desktop\tg_checkout \turbogears\controllers.py, line 378, in _execute_func File C:\Documents and Settings\Stephen\Desktop\tg_checkout \turbogears\errorhandling.py, line 73, in try_call File C:\Documents and Settings\Daystev\Desktop\srt_trunk\srt-project \srt\controllers.py, line 251, in edit request = dbmodel.request(request_id) File C:\Documents and Settings\Daystev\Desktop\srt_trunk\srt-project \srt\model.py, line 328, in request model_table.c.model_id == study_request_table.c.model_id)) File c:\documents and settings\daystev\desktop\sqlalchemy_co\lib \sqlalchemy\orm\query.py, line 270, in selectfirst ret = self.select_whereclause(whereclause=arg, **kwargs) File c:\documents and settings\daystev\desktop\sqlalchemy_co\lib \sqlalchemy\orm\query.py, line 326, in select_whereclause return self._select_statement(statement, params=params) File c:\documents and settings\daystev\desktop\sqlalchemy_co\lib \sqlalchemy\orm\query.py, line 939, in _select_statement return self.execute(statement, params=params, **kwargs) File c:\documents and settings\daystev\desktop\sqlalchemy_co\lib \sqlalchemy\orm\query.py, line 843, in execute result = self.session.execute(self.mapper, clauseelement, params=params) File c:\documents and settings\daystev\desktop\sqlalchemy_co\lib \sqlalchemy\orm\session.py, line 183, in execute return self.connection(mapper, close_with_result=True).execute(clause, params, **kwargs) File c:\documents and settings\daystev\desktop\sqlalchemy_co\lib \sqlalchemy\engine\base.py, line 496, in execute return Connection.executors[c](self, object, *multiparams, **params) File c:\documents and settings\daystev\desktop\sqlalchemy_co\lib \sqlalchemy\engine\base.py, line 536, in execute_clauseelement return self.execute_compiled(elem.compile(dialect=self.dialect, parameters=param), *multiparams, **params) File c:\documents and settings\daystev\desktop\sqlalchemy_co\lib \sqlalchemy\engine\base.py, line 547, in execute_compiled self._execute_raw(context) File c:\documents and settings\daystev\desktop\sqlalchemy_co\lib \sqlalchemy\engine\base.py, line 560, in _execute_raw self._execute(context) File c:\documents and settings\daystev\desktop\sqlalchemy_co\lib \sqlalchemy\engine\base.py, line 578, in _execute raise exceptions.SQLError(context.statement, context.parameters, e) SQLError: (DatabaseError) ORA-00904: TBL_ROW_COUNT.STUDY_REQUEST_STUDY_REQUEST_ID: invalid identifier 'SELECT study_request.model_id AS study_request_model_id, study_request.action_plan_wiki_id AS study_request_action_pla_2, anon_dd00.task AS anon_dd00_task, anon_dd00.study_request_id AS anon_dd00_study_request_id, anon_dd00.fte_days AS anon_dd00_fte_days, study_request.animals_requested AS study_request_animals_re_3, study_request.note AS study_request_note, study_request.media_type AS study_request_media_type, study_request.study_date AS study_request_study_date, study_request.study_end_date AS study_request_study_end_date, study_request.acc_protocol_id AS study_request_acc_protocol_id, study_request.justification AS
[sqlalchemy] Re: SQLError: ... invalid identifier
The mapper: mapper(StudyRequest,study_request_table,properties={'model':relation(Model, primaryjoin=model_table.c.model_id==study_request_table.c.model_id, foreign_keys=[study_request_table.c.model_id], lazy=False), #backref doesn't work in 3.6 'technicians':relation(TechnicianStudyRequest,backref='study_request',lazy=False), 'action_plans':relation(ActionPlan,backref='study_request',lazy=True), 'comp_med_resources':relation(CompMedResource,backref='study_request',lazy=False)}) The selectfirst: request = session.query(StudyRequest).selectfirst( and_(model_table.c.model_acronym == acronym, study_request_table.c.model_request_counter == counter, model_table.c.model_id == study_request_table.c.model_id)) Could the problem have something to do with the column being Numeric instead of OracleNumeric? Seems to be that way because reflection was overridden. On May 7, 3:14 pm, Michael Bayer [EMAIL PROTECTED] wrote: yeah also whats your mapper on that ? is there a string-based order_by in there somewhere (or in the query.selectfirst() call) ? i dont understand why that name wouldnt be truncated. On May 7, 2007, at 3:09 PM, shday wrote: The table is reflected here: study_request_table = Table('study_request',metadata, Column('study_request_id',Numeric(precision=6,length=0), Sequence('study_request_seq'),primary_key=True,nullable=False), autoload=True) Here in what metadata.table['study_request'] gives: Table('study_request',DynamicMetaData(),Column ('acc_protocol_id',OracleString(le ngth=8),ForeignKey ('model_acc_protocol.acc_protocol_id'),nullable=False),Column( 'mcode',OracleString(length=8)),Column ('date_submitted',OracleDateTime(timezone= False)),Column('action_plan_wiki_id',OracleNumeric (precision=10,length=0)),Colum n('fte_weeks',OracleNumeric(precision=12,length=4)),Column ('fte_weekends',Oracle Numeric(precision=12,length=4)),Column ('year_submitted',OracleNumeric(precision= 4,length=0)),Column('study_request_id',Numeric (precision=6,length=0),primary_key =True,nullable=False,default=Sequence ('study_request_seq',start=None,increment=N one,optional=False)),Column('model_id',OracleNumeric (precision=6,length=0),Forei gnKey('model_acc_protocol.model_id'),nullable=False),Column ('requester_isid',Ora cleString(length=8),nullable=False),Column ('justification',OracleString(length=4 000)),Column('study_date',OracleDateTime (timezone=False),nullable=False),Column( 'animals_requested',OracleNumeric(precision=4,length=0)),Column ('animals_used',O racleNumeric(precision=4,length=0)),Column('cancelled',OracleNumeric (precision=1 ,length=0),nullable=False,default=PassiveDefault (sqlalchemy.sql._TextClause obj ect at 0x016FB630)),Column('model_request_counter',OracleNumeric (precision=6,le ngth=0),nullable=False),Column('study_end_date',OracleDateTime (timezone=False),n ullable=False),Column('note',OracleString(length=4000)),Column ('action_plan',Ora cleBinary(length=None)),Column('media_type',OracleString (length=64)),Column('act ion_plan_md5',OracleString(length=32)),schema=None) On May 7, 2:46 pm, Michael Bayer [EMAIL PROTECTED] wrote: well its generally that the identifier name is too long. i dont exactly understand how its coming out without its proper truncation being set, and it might be related to how the oracle module redefines ORDER BY...so for now youd have to stick with 0.3.6 or shorten the column name on your table. if you want to send me the Table for that i can try to create a test out of it. On May 7, 2007, at 2:37 PM, shday wrote: I am getting a new error when using r2607. When I switch back to 3.6 there is no error. Here is the stack trace: Page handler: bound method StudyRequestController.default of srt.controllers.StudyRequestController instance at 0x015D6620 Traceback (most recent call last): File C:\Python24\lib\site-packages\cherrypy-2.2.1-py2.4.egg \cherrypy \_cphttptools.py, line 105, in _run self.main() File C:\Python24\lib\site-packages\cherrypy-2.2.1-py2.4.egg \cherrypy \_cphttptools.py, line 254, in main body = page_handler(*virtual_path, **self.params) File string, line 3, in default File C:\Documents and Settings\Stephen\Desktop\tg_checkout \turbogears\controllers.py, line 334, in expose File string, line 5, in run_with_transaction File c:\documents and settings\daystev\desktop\tg_checkout \turbogears\database.py, line 354, in sa_rwt retval = dispatch_exception(e,args,kw) File c:\documents and settings\daystev\desktop\tg_checkout \turbogears\database.py, line 343, in sa_rwt retval = func(*args, **kw) File string, line 5, in _expose File C:\Documents and Settings\Stephen\Desktop\tg_checkout \turbogears\controllers.py, line 351, in lambda File C
[sqlalchemy] Re: SQLError: ... invalid identifier
No count() anywhere. On May 7, 3:17 pm, Michael Bayer [EMAIL PROTECTED] wrote: also is there a count() stuck in there somewhere ? the tbl_row_count identifier only comes into play when theres count(). On May 7, 2007, at 3:09 PM, shday wrote: The table is reflected here: study_request_table = Table('study_request',metadata, Column('study_request_id',Numeric(precision=6,length=0), Sequence('study_request_seq'),primary_key=True,nullable=False), autoload=True) Here in what metadata.table['study_request'] gives: Table('study_request',DynamicMetaData(),Column ('acc_protocol_id',OracleString(le ngth=8),ForeignKey ('model_acc_protocol.acc_protocol_id'),nullable=False),Column( 'mcode',OracleString(length=8)),Column ('date_submitted',OracleDateTime(timezone= False)),Column('action_plan_wiki_id',OracleNumeric (precision=10,length=0)),Colum n('fte_weeks',OracleNumeric(precision=12,length=4)),Column ('fte_weekends',Oracle Numeric(precision=12,length=4)),Column ('year_submitted',OracleNumeric(precision= 4,length=0)),Column('study_request_id',Numeric (precision=6,length=0),primary_key =True,nullable=False,default=Sequence ('study_request_seq',start=None,increment=N one,optional=False)),Column('model_id',OracleNumeric (precision=6,length=0),Forei gnKey('model_acc_protocol.model_id'),nullable=False),Column ('requester_isid',Ora cleString(length=8),nullable=False),Column ('justification',OracleString(length=4 000)),Column('study_date',OracleDateTime (timezone=False),nullable=False),Column( 'animals_requested',OracleNumeric(precision=4,length=0)),Column ('animals_used',O racleNumeric(precision=4,length=0)),Column('cancelled',OracleNumeric (precision=1 ,length=0),nullable=False,default=PassiveDefault (sqlalchemy.sql._TextClause obj ect at 0x016FB630)),Column('model_request_counter',OracleNumeric (precision=6,le ngth=0),nullable=False),Column('study_end_date',OracleDateTime (timezone=False),n ullable=False),Column('note',OracleString(length=4000)),Column ('action_plan',Ora cleBinary(length=None)),Column('media_type',OracleString (length=64)),Column('act ion_plan_md5',OracleString(length=32)),schema=None) On May 7, 2:46 pm, Michael Bayer [EMAIL PROTECTED] wrote: well its generally that the identifier name is too long. i dont exactly understand how its coming out without its proper truncation being set, and it might be related to how the oracle module redefines ORDER BY...so for now youd have to stick with 0.3.6 or shorten the column name on your table. if you want to send me the Table for that i can try to create a test out of it. On May 7, 2007, at 2:37 PM, shday wrote: I am getting a new error when using r2607. When I switch back to 3.6 there is no error. Here is the stack trace: Page handler: bound method StudyRequestController.default of srt.controllers.StudyRequestController instance at 0x015D6620 Traceback (most recent call last): File C:\Python24\lib\site-packages\cherrypy-2.2.1-py2.4.egg \cherrypy \_cphttptools.py, line 105, in _run self.main() File C:\Python24\lib\site-packages\cherrypy-2.2.1-py2.4.egg \cherrypy \_cphttptools.py, line 254, in main body = page_handler(*virtual_path, **self.params) File string, line 3, in default File C:\Documents and Settings\Stephen\Desktop\tg_checkout \turbogears\controllers.py, line 334, in expose File string, line 5, in run_with_transaction File c:\documents and settings\daystev\desktop\tg_checkout \turbogears\database.py, line 354, in sa_rwt retval = dispatch_exception(e,args,kw) File c:\documents and settings\daystev\desktop\tg_checkout \turbogears\database.py, line 343, in sa_rwt retval = func(*args, **kw) File string, line 5, in _expose File C:\Documents and Settings\Stephen\Desktop\tg_checkout \turbogears\controllers.py, line 351, in lambda File C:\Documents and Settings\Stephen\Desktop\tg_checkout \turbogears\controllers.py, line 378, in _execute_func File C:\Documents and Settings\Stephen\Desktop\tg_checkout \turbogears\errorhandling.py, line 73, in try_call File C:\Documents and Settings\Daystev\Desktop\srt_trunk\srt- project \srt\controllers.py, line 232, in default return action(item, **params) File string, line 3, in edit File C:\Documents and Settings\Stephen\Desktop\tg_checkout \turbogears\controllers.py, line 330, in expose File string, line 5, in _expose File C:\Documents and Settings\Stephen\Desktop\tg_checkout \turbogears\controllers.py, line 351, in lambda File C:\Documents and Settings\Stephen\Desktop\tg_checkout \turbogears\controllers.py, line 378, in _execute_func File C:\Documents and Settings\Stephen\Desktop\tg_checkout \turbogears\errorhandling.py, line 73, in try_call File C:\Documents and Settings\Daystev\Desktop\srt_trunk\srt- project \srt
[sqlalchemy] Re: Problems Inserting into Oracle using Bind Variables from Turbo Gears Controller
I'm getting this error even though I have convert_unicode = True and the proper NLS_LANG setting: SQLError: (NotSupportedError) Variable_TypeByValue(): unhandled data type unicode 'DELETE FROM model_acc_protocol WHERE model_acc_protocol.model_id = :model_id AND model_acc_protocol.acc_protocol_id = :acc_protocol_id AND model_acc_protocol.color = :color' {'model_id': 60, 'color': u'RED', 'acc_protocol_id': u'2001-99'} I know my convert_unicode = True is doing something because it solved others problems before. Somehow it isn't working here. One thing that is different here is that the values u'RED' and u'2001-99' were pulled from the database during the same flush(). In the select statement just before this one these value were bound as 'RED' and '2001-99' instead of unicode. Any ideas? Steve On Apr 25, 1:08 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 25, 2007, at 12:26 PM, kap_ravi wrote: Apparently there is some problem with theUNICODEdatathat sqlAlchemy sends to oracle from the turbo gears framework. But I have tried the same from the python command line with named parameters and its works without any issues. feeding inunicodestrings requires that they be encoded into bytestrings first. this can be accomplished by either the usage of theUnicodetypeon your Column definitions, or by sending the flag convert_unicode=True to create_engine(). the default encoding for this flag is utf-8 which can be configured by the 'encoding' flag sent to create_engine(). additionally, when using Oracle, you have to ensure that the environment variable NLS_LANG is set appropriately, such as AMERICAN- AMERICA.UTF8. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: Problems Inserting into Oracle using Bind Variables from Turbo Gears Controller
The problem seems to be related to a backref I had. I found a way without using backref and now things work. With this I get a unicode error: acc_mapper = mapper(ACCProtocolSpecies,acc_protocol_species_table,properties={'models':relation(Model,secondary=model_acc_protocol_table,lazy=False,backref='acc_protocols'), 'study_requests':relation(StudyRequest,secondary=model_acc_protocol_table,lazy=False)}) With this I don't: acc_mapper = mapper(ACCProtocolSpecies,acc_protocol_species_table,properties={'models':relation(Model,secondary=model_acc_protocol_table,lazy=False), 'study_requests':relation(StudyRequest,secondary=model_acc_protocol_table,lazy=False)}) Here is the related tg controller code: @expose() def delete(self,model_id): model = dbmodel.session.query(dbmodel.Model).get([model_id]) acc_protocol_id = model.acc_protocols[0].acc_protocol_id species = model.acc_protocols[0].species record = dbmodel.session.query(dbmodel.ModelACCProtocol).get([model_id, acc_protocol_id, species]) dbmodel.session.delete(record) dbmodel.session.delete(model) dbmodel.session.flush() return Deleted On May 3, 12:04 pm, Michael Bayer [EMAIL PROTECTED] wrote: On May 3, 2007, at 11:25 AM, shday wrote: I'm getting this error even though I have convert_unicode = True and the proper NLS_LANG setting: SQLError: (NotSupportedError) Variable_TypeByValue(): unhandled data type unicode 'DELETE FROM model_acc_protocol WHERE model_acc_protocol.model_id = :model_id AND model_acc_protocol.acc_protocol_id = :acc_protocol_id AND model_acc_protocol.color = :color' {'model_id': 60, 'color': u'RED', 'acc_protocol_id': u'2001-99'} I know my convert_unicode = True is doing something because it solved others problems before. Somehow it isn't working here. One thing that is different here is that the values u'RED' and u'2001-99' were pulled from the database during the same flush(). In the select statement just before this one these value were bound as 'RED' and '2001-99' instead of unicode. those two values should not be u'' strings. therefore it would appear that those bindparams are untyped. if you are using bindparam () directly, add type=Unicode to it. similarly for whatever other constructs youre making which arent derived from a Column, make sure types are sent in as appropriate. ( a construct derived from a Column would look like mytable.c.somecolumn == u'foo', in that case the Unicode type should be generated automatically).- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] query stopped working in 0.3.6
I upgraded to 0.3.6 from 0.3.5 and one of my querys stopped working: s = model_table.select(~(model_table.c.therapeutic_area.in_('Respiratory','Diabetes', 'Inflammation','CVD')), order_by=[model_table.c.model_acronym]) All my other query still work fine. Although this is the only one using in_() and ~. The funny thing is that the created sql appears to be exactly the same as before. Here is the error: 2007-03-26 15:11:20,851 INFO sqlalchemy.engine.base.Engine.0x..d0 SELECT model.i nvestigator_isid, model.active, model.model_id, model.model_acronym, model.model _name, model.therapeutic_area FROM model WHERE model.therapeutic_area NOT IN (:model_therapeutic_area, :model_therapeutic _ar_1, :model_therapeutic_ar_2, :model_therapeutic_ar_3) ORDER BY model.model_ac ronym 2007-03-26 15:11:20,851 sqlalchemy.engine.base.Engine.0x..d0 INFO SELECT model.i nvestigator_isid, model.active, model.model_id, model.model_acronym, model.model _name, model.therapeutic_area FROM model WHERE model.therapeutic_area NOT IN (:model_therapeutic_area, :model_therapeutic _ar_1, :model_therapeutic_ar_2, :model_therapeutic_ar_3) ORDER BY model.model_ac ronym 2007-03-26 15:11:20,861 INFO sqlalchemy.engine.base.Engine.0x..d0 {'model_therap eutic_area': 'Respiratory', 'model_therapeutic_ar_3': 'CVD', 'model_therapeutic_ ar_2': 'Inflammation', 'model_therapeutic_ar_1': 'Diabetes'} 2007-03-26 15:11:20,861 sqlalchemy.engine.base.Engine.0x..d0 INFO {'model_therap eutic_area': 'Respiratory', 'model_therapeutic_ar_3': 'CVD', 'model_therapeutic_ ar_2': 'Inflammation', 'model_therapeutic_ar_1': 'Diabetes'} 2007-03-26 15:11:20,861 INFO sqlalchemy.engine.base.Engine.0x..d0 ROLLBACK 2007-03-26 15:11:20,861 sqlalchemy.engine.base.Engine.0x..d0 INFO ROLLBACK Traceback (most recent call last): File C:\Documents and Settings\Daystev\Desktop\srt-trunk\srt-project \start-sr t.py, line 23, in ? from srt.controllers import Root File C:\Documents and Settings\Daystev\Desktop\srt-trunk\srt-project \srt\cont rollers.py, line 9, in ? model_list = [('Respiratory',[('','Please select a model')] +dbmodel.model_li st('Respiratory')), File C:\Documents and Settings\Daystev\Desktop\srt-trunk\srt-project \srt\mode l.py, line 158, in model_list rs = s.execute() File c:\python24\lib\site-packages\sqlalchemy-0.3.6-py2.4.egg \sqlalchemy\sql. py, line 776, in execute return self.compile(engine=self.engine, parameters=compile_params).execute(* multiparams, **params) File c:\python24\lib\site-packages\sqlalchemy-0.3.6-py2.4.egg \sqlalchemy\sql. py, line 669, in execute return e.execute_compiled(self, *multiparams, **params) File c:\python24\lib\site-packages\sqlalchemy-0.3.6-py2.4.egg \sqlalchemy\engi ne\base.py, line 726, in execute_compiled return connection.execute_compiled(compiled, *multiparams, **params) File c:\python24\lib\site-packages\sqlalchemy-0.3.6-py2.4.egg \sqlalchemy\engi ne\base.py, line 503, in execute_compiled proxy(str(compiled), parameters) File c:\python24\lib\site-packages\sqlalchemy-0.3.6-py2.4.egg \sqlalchemy\engi ne\base.py, line 499, in proxy self._execute_raw(statement, parameters, cursor=cursor, context=context) File c:\python24\lib\site-packages\sqlalchemy-0.3.6-py2.4.egg \sqlalchemy\engi ne\base.py, line 547, in _execute_raw self._execute(cursor, statement, parameters, context=context) File c:\python24\lib\site-packages\sqlalchemy-0.3.6-py2.4.egg \sqlalchemy\engi ne\base.py, line 566, in _execute raise exceptions.SQLError(statement, parameters, e) sqlalchemy.exceptions.SQLError: (DatabaseError) ORA-01460: unimplemented or unre asonable conversion requested 'SELECT model.investigator_isid, model.active, model.model_id, model.model_acro nym, model.model_name, model.therapeutic_area \nFROM model \nWHERE model.therape utic_area NOT IN (:model_therapeutic_area, :model_therapeutic_ar_1, :model_thera peutic_ar_2, :model_therapeutic_ar_3) ORDER BY model.model_acronym' {'model_ther apeutic_area': 'Respiratory', 'model_therapeutic_ar_3': 'CVD', 'model_therapeuti c_ar_2': 'Inflammation', 'model_therapeutic_ar_1': 'Diabetes'} --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: query stopped working in 0.3.6
Here is the surrounding code: def model_list(therapeutic_area='All'): if therapeutic_area == 'All': s = model_table.select(order_by=[model_table.c.model_acronym]) elif therapeutic_area == 'Other': s = model_table.select(~(model_table.c.therapeutic_area.in_('Respiratory','Diabetes', 'Inflammation','CVD')), order_by=[model_table.c.model_acronym]) else: s = model_table.select(model_table.c.therapeutic_area==therapeutic_area,order_by=[model_table.c.model_acronym]) rs = s.execute() return [(str(row['model_id']),(row['model_acronym'] + - +row['model_name'])[:80]) for row in rs.fetchall()] On Mar 27, 10:29 am, shday [EMAIL PROTECTED] wrote: I upgraded to 0.3.6 from 0.3.5 and one of my querys stopped working: s = model_table.select(~(model_table.c.therapeutic_area.in_('Respiratory','Diabetes', 'Inflammation','CVD')), order_by=[model_table.c.model_acronym]) All my other query still work fine. Although this is the only one using in_() and ~. The funny thing is that the created sql appears to be exactly the same as before. Here is the error: 2007-03-26 15:11:20,851 INFO sqlalchemy.engine.base.Engine.0x..d0 SELECT model.i nvestigator_isid, model.active, model.model_id, model.model_acronym, model.model _name, model.therapeutic_area FROM model WHERE model.therapeutic_area NOT IN (:model_therapeutic_area, :model_therapeutic _ar_1, :model_therapeutic_ar_2, :model_therapeutic_ar_3) ORDER BY model.model_ac ronym 2007-03-26 15:11:20,851 sqlalchemy.engine.base.Engine.0x..d0 INFO SELECT model.i nvestigator_isid, model.active, model.model_id, model.model_acronym, model.model _name, model.therapeutic_area FROM model WHERE model.therapeutic_area NOT IN (:model_therapeutic_area, :model_therapeutic _ar_1, :model_therapeutic_ar_2, :model_therapeutic_ar_3) ORDER BY model.model_ac ronym 2007-03-26 15:11:20,861 INFO sqlalchemy.engine.base.Engine.0x..d0 {'model_therap eutic_area': 'Respiratory', 'model_therapeutic_ar_3': 'CVD', 'model_therapeutic_ ar_2': 'Inflammation', 'model_therapeutic_ar_1': 'Diabetes'} 2007-03-26 15:11:20,861 sqlalchemy.engine.base.Engine.0x..d0 INFO {'model_therap eutic_area': 'Respiratory', 'model_therapeutic_ar_3': 'CVD', 'model_therapeutic_ ar_2': 'Inflammation', 'model_therapeutic_ar_1': 'Diabetes'} 2007-03-26 15:11:20,861 INFO sqlalchemy.engine.base.Engine.0x..d0 ROLLBACK 2007-03-26 15:11:20,861 sqlalchemy.engine.base.Engine.0x..d0 INFO ROLLBACK Traceback (most recent call last): File C:\Documents and Settings\Daystev\Desktop\srt-trunk\srt-project \start-sr t.py, line 23, in ? from srt.controllers import Root File C:\Documents and Settings\Daystev\Desktop\srt-trunk\srt-project \srt\cont rollers.py, line 9, in ? model_list = [('Respiratory',[('','Please select a model')] +dbmodel.model_li st('Respiratory')), File C:\Documents and Settings\Daystev\Desktop\srt-trunk\srt-project \srt\mode l.py, line 158, in model_list rs = s.execute() File c:\python24\lib\site-packages\sqlalchemy-0.3.6-py2.4.egg \sqlalchemy\sql. py, line 776, in execute return self.compile(engine=self.engine, parameters=compile_params).execute(* multiparams, **params) File c:\python24\lib\site-packages\sqlalchemy-0.3.6-py2.4.egg \sqlalchemy\sql. py, line 669, in execute return e.execute_compiled(self, *multiparams, **params) File c:\python24\lib\site-packages\sqlalchemy-0.3.6-py2.4.egg \sqlalchemy\engi ne\base.py, line 726, in execute_compiled return connection.execute_compiled(compiled, *multiparams, **params) File c:\python24\lib\site-packages\sqlalchemy-0.3.6-py2.4.egg \sqlalchemy\engi ne\base.py, line 503, in execute_compiled proxy(str(compiled), parameters) File c:\python24\lib\site-packages\sqlalchemy-0.3.6-py2.4.egg \sqlalchemy\engi ne\base.py, line 499, in proxy self._execute_raw(statement, parameters, cursor=cursor, context=context) File c:\python24\lib\site-packages\sqlalchemy-0.3.6-py2.4.egg \sqlalchemy\engi ne\base.py, line 547, in _execute_raw self._execute(cursor, statement, parameters, context=context) File c:\python24\lib\site-packages\sqlalchemy-0.3.6-py2.4.egg \sqlalchemy\engi ne\base.py, line 566, in _execute raise exceptions.SQLError(statement, parameters, e) sqlalchemy.exceptions.SQLError: (DatabaseError) ORA-01460: unimplemented or unre asonable conversion requested 'SELECT model.investigator_isid, model.active, model.model_id, model.model_acro nym, model.model_name, model.therapeutic_area \nFROM model \nWHERE model.therape utic_area NOT IN (:model_therapeutic_area, :model_therapeutic_ar_1, :model_thera peutic_ar_2, :model_therapeutic_ar_3) ORDER BY model.model_acronym' {'model_ther apeutic_area': 'Respiratory', 'model_therapeutic_ar_3': 'CVD', 'model_therapeuti c_ar_2': 'Inflammation', 'model_therapeutic_ar_1': 'Diabetes
[sqlalchemy] Re: query stopped working in 0.3.6
Hi, The table is reflected, with one column overridden, here: model_table = Table('model',metadata, Column('model_id',Numeric(precision=6,length=0),Sequence('model_seq'), primary_key=True, nullable=False), autoload=True) Here is what the resulting Table object looks like: Table('model',DynamicMetaData(), Column('investigator_isid',OracleString(length=8),nullable=False), Column('active',OracleNumeric(precision=1,length=0),nullable=False,default=PassiveDefault(sqlalchemy.sql._TextClause object at 0x0193E850)), Column('model_id',Numeric(precision=6,length=0),primary_key=True,nullable=False, default=Sequence('model_seq',start=None,increment=None,optional=False)), Column('model_acronym',OracleString(length=32),nullable=False), Column('model_name',OracleString(length=256),nullable=False), Column('therapeutic_area',OracleString(length=32)), schema=None) On Mar 27, 12:12 pm, Michael Bayer [EMAIL PROTECTED] wrote: this is most likely a typing error and id need to see the types of columns being used. in particular if you have any String columns without a size, they are now interpreted as CLOBs which might be where its tripping up. On Mar 27, 2007, at 10:35 AM, shday wrote: Here is the surrounding code: def model_list(therapeutic_area='All'): if therapeutic_area == 'All': s = model_table.select(order_by=[model_table.c.model_acronym]) elif therapeutic_area == 'Other': s = model_table.select(~(model_table.c.therapeutic_area.in_ ('Respiratory','Diabetes', 'Inflammation','CVD')), order_by=[model_table.c.model_acronym]) else: s = model_table.select (model_table.c.therapeutic_area==therapeutic_area,order_by= [model_table.c.model_acronym]) rs = s.execute() return [(str(row['model_id']),(row['model_acronym'] + - +row['model_name'])[:80]) for row in rs.fetchall()] On Mar 27, 10:29 am, shday [EMAIL PROTECTED] wrote: I upgraded to 0.3.6 from 0.3.5 and one of my querys stopped working: s = model_table.select(~(model_table.c.therapeutic_area.in_ ('Respiratory','Diab etes', 'Inflammation','CVD')), order_by= [model_table.c.model_acronym]) All my other query still work fine. Although this is the only one using in_() and ~. The funny thing is that the created sql appears to be exactly the same as before. Here is the error: 2007-03-26 15:11:20,851 INFO sqlalchemy.engine.base.Engine.0x..d0 SELECT model.i nvestigator_isid, model.active, model.model_id, model.model_acronym, model.model _name, model.therapeutic_area FROM model WHERE model.therapeutic_area NOT IN (:model_therapeutic_area, :model_therapeutic _ar_1, :model_therapeutic_ar_2, :model_therapeutic_ar_3) ORDER BY model.model_ac ronym 2007-03-26 15:11:20,851 sqlalchemy.engine.base.Engine.0x..d0 INFO SELECT model.i nvestigator_isid, model.active, model.model_id, model.model_acronym, model.model _name, model.therapeutic_area FROM model WHERE model.therapeutic_area NOT IN (:model_therapeutic_area, :model_therapeutic _ar_1, :model_therapeutic_ar_2, :model_therapeutic_ar_3) ORDER BY model.model_ac ronym 2007-03-26 15:11:20,861 INFO sqlalchemy.engine.base.Engine.0x..d0 {'model_therap eutic_area': 'Respiratory', 'model_therapeutic_ar_3': 'CVD', 'model_therapeutic_ ar_2': 'Inflammation', 'model_therapeutic_ar_1': 'Diabetes'} 2007-03-26 15:11:20,861 sqlalchemy.engine.base.Engine.0x..d0 INFO {'model_therap eutic_area': 'Respiratory', 'model_therapeutic_ar_3': 'CVD', 'model_therapeutic_ ar_2': 'Inflammation', 'model_therapeutic_ar_1': 'Diabetes'} 2007-03-26 15:11:20,861 INFO sqlalchemy.engine.base.Engine.0x..d0 ROLLBACK 2007-03-26 15:11:20,861 sqlalchemy.engine.base.Engine.0x..d0 INFO ROLLBACK Traceback (most recent call last): File C:\Documents and Settings\Daystev\Desktop\srt-trunk\srt- project \start-sr t.py, line 23, in ? from srt.controllers import Root File C:\Documents and Settings\Daystev\Desktop\srt-trunk\srt- project \srt\cont rollers.py, line 9, in ? model_list = [('Respiratory',[('','Please select a model')] +dbmodel.model_li st('Respiratory')), File C:\Documents and Settings\Daystev\Desktop\srt-trunk\srt- project \srt\mode l.py, line 158, in model_list rs = s.execute() File c:\python24\lib\site-packages\sqlalchemy-0.3.6-py2.4.egg \sqlalchemy\sql. py, line 776, in execute return self.compile(engine=self.engine, parameters=compile_params).execute(* multiparams, **params) File c:\python24\lib\site-packages\sqlalchemy-0.3.6-py2.4.egg \sqlalchemy\sql. py, line 669, in execute return e.execute_compiled(self, *multiparams, **params) File c:\python24\lib\site-packages\sqlalchemy-0.3.6-py2.4.egg \sqlalchemy\engi ne\base.py, line 726, in execute_compiled return
[sqlalchemy] Re: query stopped working in 0.3.6
Okay, I changed the NLS_LANG setting on the oracle client to match that of the server, and now it works. I found out about it here: http://www.theserverside.com/discussions/thread.tss?thread_id=14634 On Mar 27, 1:27 pm, shday [EMAIL PROTECTED] wrote: Hi, The table is reflected, with one column overridden, here: model_table = Table('model',metadata, Column('model_id',Numeric(precision=6,length=0),Sequence('model_seq'), primary_key=True, nullable=False), autoload=True) Here is what the resulting Table object looks like: Table('model',DynamicMetaData(), Column('investigator_isid',OracleString(length=8),nullable=False), Column('active',OracleNumeric(precision=1,length=0),nullable=False,default=PassiveDefault(sqlalchemy.sql._TextClause object at 0x0193E850)), Column('model_id',Numeric(precision=6,length=0),primary_key=True,nullable=False, default=Sequence('model_seq',start=None,increment=None,optional=False)), Column('model_acronym',OracleString(length=32),nullable=False), Column('model_name',OracleString(length=256),nullable=False), Column('therapeutic_area',OracleString(length=32)), schema=None) On Mar 27, 12:12 pm, Michael Bayer [EMAIL PROTECTED] wrote: this is most likely a typing error and id need to see the types of columns being used. in particular if you have any String columns without a size, they are now interpreted as CLOBs which might be where its tripping up. On Mar 27, 2007, at 10:35 AM, shday wrote: Here is the surrounding code: def model_list(therapeutic_area='All'): if therapeutic_area == 'All': s = model_table.select(order_by=[model_table.c.model_acronym]) elif therapeutic_area == 'Other': s = model_table.select(~(model_table.c.therapeutic_area.in_ ('Respiratory','Diabetes', 'Inflammation','CVD')), order_by=[model_table.c.model_acronym]) else: s = model_table.select (model_table.c.therapeutic_area==therapeutic_area,order_by= [model_table.c.model_acronym]) rs = s.execute() return [(str(row['model_id']),(row['model_acronym'] + - +row['model_name'])[:80]) for row in rs.fetchall()] On Mar 27, 10:29 am, shday [EMAIL PROTECTED] wrote: I upgraded to 0.3.6 from 0.3.5 and one of my querys stopped working: s = model_table.select(~(model_table.c.therapeutic_area.in_ ('Respiratory','Diab etes', 'Inflammation','CVD')), order_by= [model_table.c.model_acronym]) All my other query still work fine. Although this is the only one using in_() and ~. The funny thing is that the created sql appears to be exactly the same as before. Here is the error: 2007-03-26 15:11:20,851 INFO sqlalchemy.engine.base.Engine.0x..d0 SELECT model.i nvestigator_isid, model.active, model.model_id, model.model_acronym, model.model _name, model.therapeutic_area FROM model WHERE model.therapeutic_area NOT IN (:model_therapeutic_area, :model_therapeutic _ar_1, :model_therapeutic_ar_2, :model_therapeutic_ar_3) ORDER BY model.model_ac ronym 2007-03-26 15:11:20,851 sqlalchemy.engine.base.Engine.0x..d0 INFO SELECT model.i nvestigator_isid, model.active, model.model_id, model.model_acronym, model.model _name, model.therapeutic_area FROM model WHERE model.therapeutic_area NOT IN (:model_therapeutic_area, :model_therapeutic _ar_1, :model_therapeutic_ar_2, :model_therapeutic_ar_3) ORDER BY model.model_ac ronym 2007-03-26 15:11:20,861 INFO sqlalchemy.engine.base.Engine.0x..d0 {'model_therap eutic_area': 'Respiratory', 'model_therapeutic_ar_3': 'CVD', 'model_therapeutic_ ar_2': 'Inflammation', 'model_therapeutic_ar_1': 'Diabetes'} 2007-03-26 15:11:20,861 sqlalchemy.engine.base.Engine.0x..d0 INFO {'model_therap eutic_area': 'Respiratory', 'model_therapeutic_ar_3': 'CVD', 'model_therapeutic_ ar_2': 'Inflammation', 'model_therapeutic_ar_1': 'Diabetes'} 2007-03-26 15:11:20,861 INFO sqlalchemy.engine.base.Engine.0x..d0 ROLLBACK 2007-03-26 15:11:20,861 sqlalchemy.engine.base.Engine.0x..d0 INFO ROLLBACK Traceback (most recent call last): File C:\Documents and Settings\Daystev\Desktop\srt-trunk\srt- project \start-sr t.py, line 23, in ? from srt.controllers import Root File C:\Documents and Settings\Daystev\Desktop\srt-trunk\srt- project \srt\cont rollers.py, line 9, in ? model_list = [('Respiratory',[('','Please select a model')] +dbmodel.model_li st('Respiratory')), File C:\Documents and Settings\Daystev\Desktop\srt-trunk\srt- project \srt\mode l.py, line 158, in model_list rs = s.execute() File c:\python24\lib\site-packages\sqlalchemy-0.3.6-py2.4.egg \sqlalchemy\sql. py, line 776, in execute return self.compile(engine=self.engine, parameters
[sqlalchemy] Re: Reflection including Relations
Foreign key relations *are* reflected. That information is used when you set-up 'properties'. Notice that you don't have to specify any keys when you define properties. SA just doesn't do the 'properties' automatically (by design I think). Steve On Feb 16, 12:14 pm, Andreas Jung [EMAIL PROTECTED] wrote: --On 16. Februar 2007 17:09:12 +0100 Andreas Jung [EMAIL PROTECTED] wrote: SA provide reflection support through Table(...autoload=True). Is there some extension for SA to include reflection support for relations? Otherwise you have specify the relationships using the 'properties' on your own. Sorry for this weird posting. Of course the mapped class should obtain the additional properties as defined manually through 'properties' automatically from the knowledge of the relations of the table instance. -aj application_pgp-signature_part 1KDownload --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: Adding a BLOB column to my Oracle database breaks my app
This fixed the problem. I guess the 4k limit on the BLOB size will still force me to store my files outside the database for now. I need to store mostly Word and Excel files... which tend to be a tad longer than 4k, even when they're empty! Steve On Feb 15, 10:17 am, Michael Bayer [EMAIL PROTECTED] wrote: im guessing its a value of None that I forgot to check for. try rev. 2321. also you will definitely need to use the trunk for BLOBs in oracle since the PrefetchingResultProxy fix is only in the trunk. On Feb 14, 2:02 pm, shday [EMAIL PROTECTED] wrote: I've been using an Oracle database and reflection (i.e., autoload=True). I recently added a BLOB column to the database. I never did any modification to the Python application code yet. The application was made using Turbogears and it just serves two forms, one for inserting records and one for updating . I am still able to update records, but when I do an insert I get the error below. I tried the latest oracle.py (r2303) and get the same thing (I couldn't do an svn checkout of everything because of our companies firewall). Page handler: bound method Root.insertrequest of srt.controllers.Root object at 0x0180EDB0 Traceback (most recent call last): File c:\python24\lib\site-packages\CherryPy-2.2.1-py2.4.egg\cherrypy \_cphttptools.py, line 105, in _run self.main() File c:\python24\lib\site-packages\CherryPy-2.2.1-py2.4.egg\cherrypy \_cphttptools.py, line 254, in main body = page_handler(*virtual_path, **self.params) File string, line 3, in insertrequest File c:\python24\lib\site-packages\turbogears-1.0.1-py2.4.egg \turbogears\controllers.py, line 334, in expose output = database.run_with_transaction( File string, line 5, in run_with_transaction File c:\python24\lib\site-packages\turbogears-1.0.1-py2.4.egg \turbogears\database.py, line 347, in sa_rwt retval = dispatch_exception(e,args,kw) File c:\python24\lib\site-packages\turbogears-1.0.1-py2.4.egg \turbogears\database.py, line 345, in sa_rwt transaction.commit() File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\session.py, line 54, in commit self.session.flush() File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\session.py, line 220, in flush self.uow.flush(self, objects) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 194, in flush flush_context.execute() File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 333, in execute head.execute(self) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 470, in execute UOWExecutor().execute(trans, self) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 793, in execute self.execute_save_steps(trans, task) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 815, in execute_save_steps self.execute_childtasks(trans, task, False) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 841, in execute_childtasks self.execute(trans, child, isdelete) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 793, in execute self.execute_save_steps(trans, task) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 810, in execute_save_steps self.save_objects(trans, task) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 798, in save_objects task._save_objects(trans) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 461, in _save_objects self.mapper.save_obj(self.polymorphic_tosave_objects, trans) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\mapper.py, line 998, in save_obj c = connection.execute(statement, params) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\engine\base.py, line 258, in execute return Connection.executors[type(object).__mro__[-2]](self, object, *multiparams, **params) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\engine\base.py, line 282, in execute_clauseelement return self.execute_compiled(elem.compile(engine=self.__engine, parameters=param), *multiparams, **params) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\engine\base.py, line 297, in execute_compiled context.pre_exec(self.__engine, proxy, compiled, parameters) File C:\Python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\databases\oracle.py, line 152, in pre_exec super
[sqlalchemy] Re: Adding a BLOB column to my Oracle database breaks my app
With rev. 2321 of oracle.py I'm getting the error below when I do the following: sr = session.query(StudyRequest).selectfirst(study_request_table.c.study_request_id == request_id) With 3.4 I don't get and error. Note that I'm only using oracle.py from the trunk, everything else is 3.4 Traceback (most recent call last): File console, line 1, in ? File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\ query.py, line 214, in selectfirst ret = self.select_whereclause(*args, **params) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\ query.py, line 252, in select_whereclause return self._select_statement(statement, params=params) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\ query.py, line 378, in _select_statement return self.execute(statement, params=params, **kwargs) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\ query.py, line 308, in execute result = self.session.execute(self.mapper, clauseelement, params=params) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\ session.py, line 133, in execute return self.connection(mapper, close_with_result=True).execute(clause, param s, **kwargs) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\engi ne\base.py, line 258, in execute return Connection.executors[type(object).__mro__[-2]](self, object, *multipa rams, **params) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\engi ne\base.py, line 282, in execute_clauseelement return self.execute_compiled(elem.compile(engine=self.__engine, parameters=p aram), *multiparams, **params) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\sql. py, line 511, in compile compiler.compile() File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\sql. py, line 392, in compile self.statement.accept_visitor(self) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\sql. py, line 1607, in accept_visitor self.order_by_clause.accept_visitor(visitor) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\sql. py, line 915, in accept_visitor c.accept_visitor(visitor) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\sql. py, line 1259, in accept_visitor visitor.visit_column(self) File C:\Python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\data bases\oracle.py, line 378, in visit_column File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\ansi sql.py, line 218, in visit_column n = self.dialect.oid_column_name() TypeError: oid_column_name() takes exactly 2 arguments (1 given) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Adding a BLOB column to my Oracle database breaks my app
I've been using an Oracle database and reflection (i.e., autoload=True). I recently added a BLOB column to the database. I never did any modification to the Python application code yet. The application was made using Turbogears and it just serves two forms, one for inserting records and one for updating . I am still able to update records, but when I do an insert I get the error below. I tried the latest oracle.py (r2303) and get the same thing (I couldn't do an svn checkout of everything because of our companies firewall). Page handler: bound method Root.insertrequest of srt.controllers.Root object at 0x0180EDB0 Traceback (most recent call last): File c:\python24\lib\site-packages\CherryPy-2.2.1-py2.4.egg\cherrypy \_cphttptools.py, line 105, in _run self.main() File c:\python24\lib\site-packages\CherryPy-2.2.1-py2.4.egg\cherrypy \_cphttptools.py, line 254, in main body = page_handler(*virtual_path, **self.params) File string, line 3, in insertrequest File c:\python24\lib\site-packages\turbogears-1.0.1-py2.4.egg \turbogears\controllers.py, line 334, in expose output = database.run_with_transaction( File string, line 5, in run_with_transaction File c:\python24\lib\site-packages\turbogears-1.0.1-py2.4.egg \turbogears\database.py, line 347, in sa_rwt retval = dispatch_exception(e,args,kw) File c:\python24\lib\site-packages\turbogears-1.0.1-py2.4.egg \turbogears\database.py, line 345, in sa_rwt transaction.commit() File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\session.py, line 54, in commit self.session.flush() File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\session.py, line 220, in flush self.uow.flush(self, objects) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 194, in flush flush_context.execute() File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 333, in execute head.execute(self) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 470, in execute UOWExecutor().execute(trans, self) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 793, in execute self.execute_save_steps(trans, task) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 815, in execute_save_steps self.execute_childtasks(trans, task, False) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 841, in execute_childtasks self.execute(trans, child, isdelete) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 793, in execute self.execute_save_steps(trans, task) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 810, in execute_save_steps self.save_objects(trans, task) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 798, in save_objects task._save_objects(trans) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\unitofwork.py, line 461, in _save_objects self.mapper.save_obj(self.polymorphic_tosave_objects, trans) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\orm\mapper.py, line 998, in save_obj c = connection.execute(statement, params) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\engine\base.py, line 258, in execute return Connection.executors[type(object).__mro__[-2]](self, object, *multiparams, **params) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\engine\base.py, line 282, in execute_clauseelement return self.execute_compiled(elem.compile(engine=self.__engine, parameters=param), *multiparams, **params) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\engine\base.py, line 297, in execute_compiled context.pre_exec(self.__engine, proxy, compiled, parameters) File C:\Python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\databases\oracle.py, line 152, in pre_exec super(OracleExecutionContext, self).pre_exec(engine, proxy, compiled, parameters) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\engine\default.py, line 128, in pre_exec self._process_defaults(engine, proxy, compiled, parameters) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\engine\default.py, line 204, in _process_defaults elif not param.has_key(c.key) or param[c.key] is None: File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\sql.py, line 321, in __getitem__ v = self.binds[key].typeprocess(v, self.dialect) File c:\python24\lib\site-packages\sqlalchemy-0.3.4-py2.4.egg \sqlalchemy\sql.py, line 836, in typeprocess return
[sqlalchemy] Re: Using pickle to save reflected metadata
I still get the error: Traceback (most recent call last): File U:/ADA_tools/pickle_tables.py, line 27, in ? pickle.dump(metadata_to_pickle,pfile) File C:\Python24\lib\pickle.py, line 1382, in dump Pickler(file, protocol, bin).dump(obj) File C:\Python24\lib\pickle.py, line 231, in dump self.save(obj) File C:\Python24\lib\pickle.py, line 338, in save self.save_reduce(obj=obj, *rv) File C:\Python24\lib\pickle.py, line 433, in save_reduce save(state) File C:\Python24\lib\pickle.py, line 293, in save f(self, obj) # Call unbound method with explicit self File C:\Python24\lib\pickle.py, line 663, in save_dict self._batch_setitems(obj.iteritems()) File C:\Python24\lib\pickle.py, line 677, in _batch_setitems save(v) File C:\Python24\lib\pickle.py, line 293, in save f(self, obj) # Call unbound method with explicit self File C:\Python24\lib\pickle.py, line 663, in save_dict self._batch_setitems(obj.iteritems()) File C:\Python24\lib\pickle.py, line 677, in _batch_setitems save(v) File C:\Python24\lib\pickle.py, line 338, in save self.save_reduce(obj=obj, *rv) File C:\Python24\lib\pickle.py, line 433, in save_reduce save(state) File C:\Python24\lib\pickle.py, line 293, in save f(self, obj) # Call unbound method with explicit self File C:\Python24\lib\pickle.py, line 663, in save_dict self._batch_setitems(obj.iteritems()) File C:\Python24\lib\pickle.py, line 677, in _batch_setitems save(v) File C:\Python24\lib\pickle.py, line 338, in save self.save_reduce(obj=obj, *rv) File C:\Python24\lib\pickle.py, line 433, in save_reduce save(state) File C:\Python24\lib\pickle.py, line 293, in save f(self, obj) # Call unbound method with explicit self File C:\Python24\lib\pickle.py, line 663, in save_dict self._batch_setitems(obj.iteritems()) File C:\Python24\lib\pickle.py, line 677, in _batch_setitems save(v) File C:\Python24\lib\pickle.py, line 338, in save self.save_reduce(obj=obj, *rv) File C:\Python24\lib\pickle.py, line 433, in save_reduce save(state) File C:\Python24\lib\pickle.py, line 293, in save f(self, obj) # Call unbound method with explicit self File C:\Python24\lib\pickle.py, line 663, in save_dict self._batch_setitems(obj.iteritems()) File C:\Python24\lib\pickle.py, line 677, in _batch_setitems save(v) File C:\Python24\lib\pickle.py, line 293, in save f(self, obj) # Call unbound method with explicit self File C:\Python24\lib\pickle.py, line 663, in save_dict self._batch_setitems(obj.iteritems()) File C:\Python24\lib\pickle.py, line 676, in _batch_setitems save(k) File C:\Python24\lib\pickle.py, line 338, in save self.save_reduce(obj=obj, *rv) File C:\Python24\lib\pickle.py, line 433, in save_reduce save(state) File C:\Python24\lib\pickle.py, line 293, in save f(self, obj) # Call unbound method with explicit self File C:\Python24\lib\pickle.py, line 663, in save_dict self._batch_setitems(obj.iteritems()) File C:\Python24\lib\pickle.py, line 677, in _batch_setitems save(v) File C:\Python24\lib\pickle.py, line 313, in save rv = reduce(self.proto) File C:\Python24\lib\copy_reg.py, line 69, in _reduce_ex raise TypeError, can't pickle %s objects % base.__name__ TypeError: can't pickle module objects --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: Using pickle to save reflected metadata
whoops... I've been using IDLE to test this and I guess it has to be reopened in order for imports to be redone (I was just closing the shell window). pickle.dump(metadata) works fine now. But now I get a (recursive?) error when I try to unpickle (and I have to kill the shell): import pickle pfile = file('pickled_tables','rb') metadata = pickle.load(pfile) Traceback (most recent call last): File pyshell#7, line 1, in -toplevel- metadata = pickle.load(pfile) File C:\Python24\lib\pickle.py, line 1390, in load return Unpickler(file).load() File C:\Python24\lib\pickle.py, line 872, in load dispatch[key](self) File C:\Python24\lib\pickle.py, line 1235, in load_build setstate = getattr(inst, __setstate__, None) File C:\Python24\lib\site-packages\sqlalchemy\util.py, line 113, in __getattr__ return self.__data[key] File C:\Python24\lib\site-packages\sqlalchemy\util.py, line 113, in __getattr__ return self.__data[key] File C:\Python24\lib\site-packages\sqlalchemy\util.py, line 113, in __getattr__ . . . keeps on going --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---