[sqlalchemy] Re: SQLError: ... invalid identifier
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:\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
[sqlalchemy] Re: SQLError: ... invalid identifier
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\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,
[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
[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
[sqlalchemy] Re: SQLError: ... invalid identifier
k i got it, rev 2609. On May 7, 2007, at 3:44 PM, shday wrote: 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