[sqlalchemy] missing constraint
Hi My app is using SQLAlchemy0.5.6. I have a class defined as follows. class EmailSetup(DeclarativeBase): __tablename__ = 'emailsetup' id = Column(Unicode(50), primary_key=True) mail_server=Column(Unicode(255)) description=Column(String(200)) port = Column(Integer) use_secure = Column(Integer) #No, TLS, SSL site_id = Column(Unicode(50), ForeignKey('sites.id',onupdate=CASCADE, ondelete=CASCADE)) credential=relation(Credential, \ primaryjoin=id == Credential.entity_id,\ foreign_keys=[Credential.entity_id],\ uselist=False,cascade='all, delete, delete- orphan') this works fine on ubuntu installation . (MySQL 5.1.37) it creates foreign constraint to the sites table. CREATE TABLE `emailsetup` ( `id` varchar(50) NOT NULL, `mail_server` varchar(255) DEFAULT NULL, `description` varchar(200) DEFAULT NULL, `port` int(11) DEFAULT NULL, `use_secure` int(11) DEFAULT NULL, `site_id` varchar(50) DEFAULT NULL, PRIMARY KEY (`id`), KEY `site_id` (`site_id`), CONSTRAINT `emailsetup_ibfk_1` FOREIGN KEY (`site_id`) REFERENCES `sites` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 But in centos (MySQL 5.0.77) , the foreign key constraint is missing when i check with a show create table. CREATE TABLE `emailsetup` ( `id` varchar(50) NOT NULL, `mail_server` varchar(255) default NULL, `description` varchar(200) default NULL, `port` int(11) default NULL, `use_secure` int(11) default NULL, `site_id` varchar(50) default NULL, PRIMARY KEY (`id`), KEY `site_id` (`site_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 any idea what is happening Is this an issue related to SA or MySQL? Thanks -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] SA-oracle bitwise operator
Hi I am using SA-oracle for my application. I need to write an oracle query in which i need to use BITAND oracle bitwise operator function. Is SA provides this functionality? DECODE(BITAND(task_calendars.day ,day1))) The SA QUERY is SELECT task_calendars.cal_id AS task_calendars_cal_id, task_calendars.task_id AS task_calendars_task_id, task_calendars.dow AS task_calendars_dow, task_calendars.month AS task_calendars_month, task_calendars.day AS task_calendars_day, task_calendars.hour AS task_calendars_hour, task_calendars.minute AS task_calendars_minute, tasks_1.task_id AS tasks_1_task_id, tasks_1.task_type AS tasks_1_task_type, tasks_1.name AS tasks_1_name, tasks_1.entity_id AS tasks_1_entity_id, tasks_1.entity_name AS tasks_1_entity_name, tasks_1.context AS tasks_1_context, tasks_1.params AS tasks_1_params, tasks_1.kw_params AS tasks_1_kw_params, tasks_1.processors AS tasks_1_processors, tasks_1.user_name AS tasks_1_user_name, tasks_1.submitted_on AS tasks_1_submitted_on, tasks_1.repeating AS tasks_1_repeating, tasks_1.cancellable AS tasks_1_cancellable \nFROM task_calendars LEFT OUTER JOIN tasks tasks_1 ON tasks_1.task_id = task_calendars.task_id WHERE (task_calendars.dow = :dow_1 OR (task_calendars.dow :dow_2)) :param_1' {'dow_2': 1, 'dow_1': 0, 'param_1': False} I would appreciate any help. Thanks -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] SA-SID issue
Hi I am using Oracle with SQLalchemy in my application. 1. The SQLalchemy documentation gives the following as the connect string for Oracle sqlalchemy.url=oracle://user:passw...@localhost:1521/ SID_name 2. The above connect string does not seem to work in my application. I get the following error: sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12505: TNS:listener does not currently know of SID given in connect descriptor 3. However, my application works without the SID_name as shown below: sqlalchemy.url=oracle://user:passw...@localhost:1521 4. I created the database schema in Oracle DBManager using the Create User menu option Could someone please tell me what I am doing wrong? I would appreciate any help. Thanks -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] lockmode-SA-error
Hi I am using oracle/mysql and sqlalchemy for a project I am working on. I have a query executed like this SELECT table_entity_id, table_entity_type, table_avail_state, table_monit_state, table_transient_state, table_transient__1, table_owner, table_timestamp, table_description FROM (SELECT table_entity_id, table_entity_type, table_avail_state, table_monit_state, table_transient_state, table_transient__1, table_owner, table_timestamp, table_description, ROWNUM AS ora_rn FROM (SELECT table.entity_id AS table_entity_id, table.entity_type AS table_entity_type, table.avail_state AS table_avail_state, table.monit_state AS table_monit_state, table.transient_state AS table_transient_state, table.transient_state_time AS table_transient__1, table.owner AS table_owner, table.timestamp AS table_timestamp, table.description AS table_description FROM table WHERE table.entity_id = d282-08a9-272a-458a22e93f74 FOR UPDATE) WHERE ROWNUM =1) WHERE ora_rn 0 This query uses FOR UPDATE in one of the select statements,where there am using a lockmode to a row in SA The query works fine with mysql but it fails in oracle with errorMissing right parenthesis. While I am excuting the single select command with FOR UPDATE it works fine for the given nested query it gives error,But with out the FOR UPDTAE syntax the query works fine with ORACLE I thing this an error for Lockmode using in a nested query. The error i have like this: DatabaseError: (DatabaseError) ORA-00907: missing right parenthesis Any help is appreciable Thanks -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] SA-Lockmode-oracle
Hi I am using oracle/mysql and sqlalchemy for a project I am working on. I am using lockmode in SA query,while generating an ORACLE query it causes trouble. The class definition is like this: class AvailState(Base): MONITORING = 1 NOT_MONITORING = 0 __tablename__ = 'avail_current' entity_id = Column(Unicode(50),Sequence('entity_id_seq'), primary_key = True) entity_type = Column(Integer) avail_state = Column(Integer) monit_state = Column(Integer) transient_state = Column(Unicode(255)) transient_state_time = Column(DateTime) owner = Column(Unicode(255)) timestamp = Column(DateTime) description = Column(Unicode(256) I have the table generated: Table ColumnData Type AVAIL_CURRENT ENTITY_ID Varchar2 ENTITY_TYPE Number AVAIL_STATE Number MONIT_STATE Number TRANSIENT_STATEVarchar2 TRANSIENT_STATE_TIME Date OWNER Varchar2 TIMESTAMP Date DESCRIPTION Varchar2 The query I have written in SA is: avail_states=DBSession.query(AvailState).with_lockmode(cls.lockmode).\ filter(AvailState.entity_id.in_(input_entityids)).\ order_by(AvailState.entity_type.asc()).\ order_by(AvailState.entity_id.asc()).\ order_by(AvailState.owner.asc()).all() The SA-generated query is : SELECT avail_current_entity_id, avail_current_entity_type, avail_current_avail_state, avail_current_monit_state, avail_current_transient_state, avail_current_transient__1, avail_current_owner, avail_current_timestamp, avail_current_description FROM (SELECT avail_current_entity_id, avail_current_entity_type, avail_current_avail_state, avail_current_monit_state, avail_current_transient_state, avail_current_transient__1, avail_current_owner, avail_current_timestamp, avail_current_description, ROWNUM AS ora_rn FROM (SELECT avail_current.entity_id AS avail_current_entity_id, avail_current.entity_type AS avail_current_entity_type, avail_current.avail_state AS avail_current_avail_state, avail_current.monit_state AS avail_current_monit_state, avail_current.transient_state AS avail_current_transient_state, avail_current.transient_state_time AS avail_current_transient__1, avail_current.owner AS avail_current_owner, avail_current.timestamp AS avail_current_timestamp, avail_current.description AS avail_current_description FROM avail_current WHERE avail_current.entity_id = bc3e8724-d282-08a9-272a-458a22e93f74 FOR UPDATE) WHERE ROWNUM =1) WHERE ora_rn 0 The query works fine with MYSQL I am geting an error like this Traceback (most recent call last): File model/availability.py, line 278, in set_none_state avail=DBSession.query(AvailState).with_lockmode(cls.lockmode).\ File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/orm/query.py, line 1300, in first ret = list(self[0:1]) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/orm/query.py, line 1221, in __getitem__ return list(res) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/orm/query.py, line 1361, in __iter__ return self._execute_and_instances(context) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/orm/query.py, line 1364, in _execute_and_instances result = self.session.execute(querycontext.statement, params=self._params, mapper=self._mapper_zero_or_none()) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/orm/session.py, line 754, in execute return self.__connection(engine, close_with_result=True).execute( File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/engine/base.py, line 824, in execute return Connection.executors[c](self, object, multiparams, params) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/engine/base.py, line 874, in _execute_clauseelement return self.__execute_context(context) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/engine/base.py, line 896, in __execute_context self._cursor_execute(context.cursor, context.statement, context.parameters[0], context=context) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/engine/base.py, line 950, in _cursor_execute self._handle_dbapi_exception(e, statement, parameters, cursor, context) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6-
Re: [sqlalchemy] SA-Lockmode-oracle
Hi, Thanks for the quick reply. In my query i am not using any limit()/offset()/first() but i am using order by ascending. can order by cause an issue?? avail_states=DBSession.query( AvailState).with_lockmode('update').\ filter(AvailState.entity_id.in_(input_entityids)).\ order_by(AvailState.entity_type.asc()).\ order_by(AvailState.entity_id.asc()).\ order_by(AvailState.owner.asc()).all() the given python code is the actual code ( stack trace got modified while i removed some package names. sorry about that.) In mysql same code generates a single select for update query. in oracle it translates into 3 nested queries. thnx again On Wed, May 26, 2010 at 9:53 AM, Michael Bayer mike...@zzzcomputing.comwrote: On May 26, 2010, at 9:16 AM, dhanil anupurath wrote: Hi I am using oracle/mysql and sqlalchemy for a project I am working on. I am using lockmode in SA query,while generating an ORACLE query it causes trouble. The class definition is like this: class AvailState(Base): MONITORING = 1 NOT_MONITORING = 0 __tablename__ = 'avail_current' entity_id = Column(Unicode(50),Sequence('entity_id_seq'), primary_key = True) entity_type = Column(Integer) avail_state = Column(Integer) monit_state = Column(Integer) transient_state = Column(Unicode(255)) transient_state_time = Column(DateTime) owner = Column(Unicode(255)) timestamp = Column(DateTime) description = Column(Unicode(256) I have the table generated: TableColumnData Type AVAIL_CURRENT ENTITY_ID Varchar2 ENTITY_TYPE Number AVAIL_STATE Number MONIT_STATE Number TRANSIENT_STATEVarchar2 TRANSIENT_STATE_TIME Date OWNER Varchar2 TIMESTAMP Date DESCRIPTION Varchar2 The query I have written in SA is: avail_states=DBSession.query(AvailState).with_lockmode(cls.lockmode).\ filter(AvailState.entity_id.in_(input_entityids)).\ order_by(AvailState.entity_type.asc()).\ order_by(AvailState.entity_id.asc()).\ order_by(AvailState.owner.asc()).all() The SA-generated query is : SELECT avail_current_entity_id, avail_current_entity_type, avail_current_avail_state, avail_current_monit_state, avail_current_transient_state, avail_current_transient__1, avail_current_owner, avail_current_timestamp, avail_current_description FROM (SELECT avail_current_entity_id, avail_current_entity_type, avail_current_avail_state, avail_current_monit_state, avail_current_transient_state, avail_current_transient__1, avail_current_owner, avail_current_timestamp, avail_current_description, ROWNUM AS ora_rn FROM (SELECT avail_current.entity_id AS avail_current_entity_id, avail_current.entity_type AS avail_current_entity_type, avail_current.avail_state AS avail_current_avail_state, avail_current.monit_state AS avail_current_monit_state, avail_current.transient_state AS avail_current_transient_state, avail_current.transient_state_time AS avail_current_transient__1, avail_current.owner AS avail_current_owner, avail_current.timestamp AS avail_current_timestamp, avail_current.description AS avail_current_description FROM avail_current WHERE avail_current.entity_id = bc3e8724-d282-08a9-272a-458a22e93f74 FOR UPDATE) WHERE ROWNUM =1) WHERE ora_rn 0 Oracle apparently cannot nest FOR UPDATE inside a nested query (ticket 1815 is added for this issue). You will have to forego the usage of limit()/offset()/first() in your query, and only use all(). (Your example python code is not the actual code since it doesn't match your stacktrace). -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.comsqlalchemy%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] Re: Sql alchemy-Oracle Error
Hi thanks for the quick reply and pointing me in the right direction. it seems the error is actually related to the operator. is there anything SA can do on this issue? In the meantime i am going to change my query. thanks again.. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
Re: [sqlalchemy] Re: Sql alchemy-Oracle Error
Hi SORRY for the delay to reply. Here is what my definitions. These are my class and table definitions: class Task(DeclarativeBase): task_id = Column(Integer,Sequence('id_ seq'), primary_key=True) task_type = Column(Unicode(50), default=to_unicode('Task')) name = Column(Unicode(256)) entity_id = Column(Unicode(256)) entity_name = Column(Unicode(50)) context = Column(PickleType) params = Column(PickleType) kw_params = Column(PickleType) processors = Column(ImmutablePickleType) class TaskCalendar(DeclarativeBase): __tablename__ = 'task_calendars1' cal_id = Column(Integer,Sequence('id_ seq'), primary_key=True) task_id = Column(Integer, ForeignKey('tasks.task_id')) dow = Column(Integer) month = Column(Integer) day = Column(Integer) hour = Column(Integer) minute = Column(Integer) task = relation(Task, backref=backref('calendar') _tablename_=tasks TASK_ID Number TASK_TYPEVarchar2 NAME Varchar2 ENTITY_IDVarchar2 ENTITY_NAME Varchar2 CONTEXT Blob PARAMS Blob KW_PARAMSBlob PROCESSORS Blob task = relation(Task, backref=backref('calendar')) This is the query what am trying to do. tasks=DBSession..query(TaskCalendar).options(eagerload('task')).\ filter((TaskCalendar.dow == 0) |\ TaskCalendar.dow.op('')(1 now[6]) 0) (3)SELECT task_calendars.cal_id AS task_calendars_cal_id, task_calendars.task_id AS task_calendars_task_id, task_calendars.dow AS task_calendars_dow, task_calendars.month AS task_calendars_month, task_calendars.day AS task_calendars_day, task_calendars.hour AS task_calendars_hour, task_calendars.minute AS task_calendars_minute, tasks_1.task_id AS tasks_1_task_id, tasks_1.task_type AS tasks_1_task_type, tasks_1.name AS tasks_1_name, tasks_1.entity_id AS tasks_1_entity_id, tasks_1.entity_name AS tasks_1_entity_name, tasks_1.context AS tasks_1_context, tasks_1.params AS tasks_1_params, tasks_1.kw_params AS tasks_1_kw_params, tasks_1.processors AS tasks_1_processors, tasks_1.user_name AS tasks_1_user_name, tasks_1.submitted_on AS tasks_1_submitted_on, tasks_1.repeating AS tasks_1_repeating FROM task_calendars LEFT OUTER JOIN tasks tasks_1 ON tasks_1.task_id = task_calendars.task_id I have the Blob error with thease ORA-00932: inconsistent datatypes: expected NUMBER got BLOB HELP ME TO FIX THESE PROBLEM THANKS -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] Re: Sql alchemy-Oracle Error
Hi task = Task(u'Task',\ {'quiet':False}, [], {}, None, u'admin') model.DBSession.merge(task) in my database the following query will try to select the above task object and result in error DBSession.query(TaskCalendar).options(eagerload('task')).\ filter((TaskCalendar.dow == 0) |\ TaskCalendar.dow.op('')(1 now[6]) 0).filter(TaskCalendar.task_id == 19).all() thanks -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] Blob Issue
Hi I am having a trouble with SA-oracle-Blob datatype. Here I have a test program like this. import pkg_resources pkg_resources.require(cx-Oracle=5.0.3) import cx_Oracle import sqlalchemy from sqlalchemy.sql import select db=sqlalchemy.create_engine('oracle://cse:c...@localhost') conn = db.connect() result=conn.execute(select([dummy])) print helloo print result.fetchone() conn.close() cse is the username and password for ORACLE schema duumy is the table name ,it has a column with datatype BLob. For this am geting the result with the error, ORA-00932: inconsistent datatypes: expected NUMBER got BLOB Is there is any solution so that i do can do more complecated select statements. Is Blob not supported for ORACLE-SA -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] Blob Issue
Hi I am having a trouble with SA-oracle-Blob datatype. Here I have a test program like this. import pkg_resources pkg_resources.require(cx-Oracle=5.0.3) import cx_Oracle import sqlalchemy from sqlalchemy.sql import select db=sqlalchemy.create_engine('oracle://cse:c...@localhost') conn = db.connect() result=conn.execute(select([dummy])) print helloo print result.fetchone() conn.close() cse is the username and password for ORACLE schema duumy is the table name ,it has a column with datatype BLob. For this am geting the result with the error, ORA-00932: inconsistent datatypes: expected NUMBER got BLOB Is there is any solution so that i do can do more complecated select statements. Is Blob not supported for ORACLE-SA Any help is encouraged. THANKS -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] Re: Sql alchemy-Oracle Error
Hi This is my class definition class TaskCalendar(DeclarativeBase): __tablename__ = 'task_calendars1' cal_id = Column(Integer,Sequence('id_seq'), primary_key=True) task_id = Column(Integer, ForeignKey('tasks.task_id')) dow = Column(Integer) month = Column(Integer) day = Column(Integer) hour = Column(Integer) minute = Column(Integer) task = relation(Task, backref=backref('calendar')) This is what am trying to do tasks=DBSession.query(TaskCalendar).options(eagerload('task')) The query is as follows SELECT task_calendars1.cal_id AS task_calendars1_cal_id, task_calendars1.task_id AS task_calendars1_task_id,tasks_1.name AS tasks_1_name, tasks_1.entity_id AS tasks_1_entity_id, tasks_1.entity_name AS tasks_1_entity_name, tasks_1.context AS tasks_1_context FROM task_calendars1 LEFT OUTER JOIN tasks tasks_1 ON tasks_1.task_id = task_calendars1.task_id if i remove tasks_1.context this query works fine context column is of pickletype datatype in class and Blob in Database This is the error message: ORA-00932: inconsistent datatypes: expected NUMBER got BLOB Thankful for any suggestions -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] Sql alchemy-Oracle Error
Hi I am using sqlalchemy in my TurboGears application. some of my classes has columns with Pickletype dataType. these get converted to BLOB dataType in the database. I was using mySql till recently and everything was working fine. Now i am shifting to oracle. Tables are getting created properly. (setup-app in tg project ran successfully). But when i try to query a table having BLOB column , i get the following error. Exception in thread Thread-22: Traceback (most recent call last): File /usr/lib/python2.4/threading.py, line 442, in __bootstrap self.run() File /svnee/trunk/src/core/services/task_service.py, line 76, in check_calendar_tasks for cal in conn.query(Task).\ File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/orm/query.py, line 1361, in __iter__ return self._execute_and_instances(context) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/orm/query.py, line 1364, in _execute_and_instances result = self.session.execute(querycontext.statement, params=self._params, mapper=self._mapper_zero_or_none()) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/orm/session.py, line 754, in execute return self.__connection(engine, close_with_result=True).execute( File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/engine/base.py, line 824, in execute return Connection.executors[c](self, object, multiparams, params) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/engine/base.py, line 874, in _execute_clauseelement return self.__execute_context(context) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/engine/base.py, line 896, in __execute_context self._cursor_execute(context.cursor, context.statement, context.parameters[0], context=context) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/engine/base.py, line 950, in _cursor_execute self._handle_dbapi_exception(e, statement, parameters, cursor, context) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/engine/base.py, line 931, in _handle_dbapi_exception raise exc.DBAPIError.instance(statement, parameters, e, connection_invalidated=is_disconnect) DatabaseError: (DatabaseError) ORA-01036: illegal variable name/number i did a normal select query from sqlplus: select * from tasks; ORA-00932: inconsistent datatypes: expected NUMBER got BLOB These are my class and table definitions: class Task(DeclarativeBase): task_id = Column(Integer,Sequence('id_seq'), primary_key=True) task_type = Column(Unicode(50), default=to_unicode('Task')) name = Column(Unicode(256)) entity_id = Column(Unicode(256)) entity_name = Column(Unicode(50)) context = Column(PickleType) params = Column(PickleType) kw_params = Column(PickleType) processors = Column(ImmutablePickleType) _tablename_=tasks TASK_ID Number TASK_TYPEVarchar2 NAME Varchar2 ENTITY_IDVarchar2 ENTITY_NAME Varchar2 CONTEXT Blob PARAMS Blob KW_PARAMSBlob PROCESSORS Blob USER_NAME Varchar2 SUBMITTED_ON Date 7 REPEATING Number anyone has any idea what's wrong? please help . Thanks -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
Re: [sqlalchemy] Oracle-Tg2 Combination,sqlalchemy error
THANK YOU -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] Oracle-Tg2 Combination,sqlalchemy error
Hi, I need help in setting up Oracle under TG/sqlalchemy environment. I believe the issue is more of a SQLAlchemy issue and that is why i am posting here. Here's what i have done. 1.Installed TG2 and Sqlalchemy. 2.Installed Oracle Express 10g. 3.confirmed that I am able to access oracle using Sqlplus. 4.Installed cx_Oracle. 5.Wrote short test program in python to access my database using cx_Oracle.The program worked fine. Here's the test program. import pkg_resources pkg_resources.require(cx-Oracle=5.0.3) import cx_Oracle connstr='username/password@localhost' conn = cx_Oracle.connect(connstr) curs = conn.cursor() curs.execute('select * from tabs') print curs.description print curs.fetchone() conn.close() 6.started my application after configuring it for Oracle Express. 7.Here's the error I got. File /root/tg2env/lib/python2.4/site-packages/ SQLAlchemy-0.5.6-py2.4.egg/sqlalchemy/engine/base.py, line 1229, in contextual_connect return self.Connection(self, self.pool.connect(), close_with_result=close_with_result, **kwargs) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 142, in connect return _ConnectionFairy(self).checkout() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 304, in __init__ rec = self._connection_record = pool.get() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 161, in get return self.do_get() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 639, in do_get con = self.create_connection() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 122, in create_connection return _ConnectionRecord(self) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 198, in __init__ self.connection = self.__connect() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 261, in __connect connection = self.__pool._creator() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/engine/strategies.py, line 80, in connect raise exc.DBAPIError.instance(None, None, e) sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12505: TNS:listener does not currently know of SID given in connect descriptor None None 8. Here are the .ORA files. TNSNAMES.ora # tnsnames.ora Network Configuration File: XE = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521)) CONNECT_DATA = (SID = XE)) ) sqlnet.authentication_services = (NONE) LISTENER.ORA # listener.ora Network Configuration File: SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /usr/lib/oracle/xe/app/ oracle/product/10.2.0/server) (PROGRAM = extproc) ) (SID_DESC = (SID_NAME = m...@localhost) (ORACLE_HOME = /usr/lib/oracle/xe/app/oracle/ product/10.2.0/server) ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE)) (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521)) ) ) DEFAULT_SERVICE_LISTENER = (XE) SQLNET.ORA This is the uncommented line in the sqlnet.ora 9.On googling ,I saw someone indicate that sql.authentication should be set to none. I did that but no avail. I would really appreciate any help in resolving this problem. Thanks. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] ora-28547
HI I have been using the oracle database for my appliaction. i set the environment variables as export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/ server export PATH=$PATH:$ORACLE_HOME/bin export LD_LIBRARY_PATH=$ORACLE_HOME/lib export ORACLE_SID=XE I started the oracle instance ,and the listener is also in the work status. While running my app i got an error, follows the tracebacks.. File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 304, in __init__ rec = self._connection_record = pool.get() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 161, in get return self.do_get() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 639, in do_get con = self.create_connection() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 122, in create_connection return _ConnectionRecord(self) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 198, in __init__ self.connection = self.__connect() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 261, in __connect connection = self.__pool._creator() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/engine/strategies.py, line 80, in connect raise exc.DBAPIError.instance(None, None, e) sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-28547: connection to server failed, probable Oracle Net admin error None None Any kind of help is appreciable. Thanks. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] database error.
Am geting the error for using ORACLE database for MYSQL its fine. the out put tracebackl is geting as. Traceback (most recent call last): File /root/tg2env/bin/paster, line 7, in ? sys.exit( File /root/tg2env/lib/python2.4/site-packages/PasteScript-1.7.3- py2.4.egg/paste/script/command.py, line 84, in run invoke(command, command_name, options, args[1:]) File /root/tg2env/lib/python2.4/site-packages/PasteScript-1.7.3- py2.4.egg/paste/script/command.py, line 123, in invoke exit_code = runner.run(args) File /root/tg2env/lib/python2.4/site-packages/PasteScript-1.7.3- py2.4.egg/paste/script/appinstall.py, line 68, in run return super(AbstractInstallCommand, self).run(new_args) File /root/tg2env/lib/python2.4/site-packages/PasteScript-1.7.3- py2.4.egg/paste/script/command.py, line 218, in run result = self.command() File /root/tg2env/lib/python2.4/site-packages/PasteScript-1.7.3- py2.4.egg/paste/script/appinstall.py, line 455, in command installer.setup_config( File /root/tg2env/lib/python2.4/site-packages/PasteScript-1.7.3- py2.4.egg/paste/script/appinstall.py, line 597, in setup_config self._call_setup_app( File /root/tg2env/lib/python2.4/site-packages/PasteScript-1.7.3- py2.4.egg/paste/script/appinstall.py, line 612, in _call_setup_app func(command, conf, vars) File /svnee/trunk/src/convirt/web/convirt/convirt/websetup.py, line 95, in setup_app model.metadata.create_all(bind=config['pylons.app_globals'].sa_engine) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/schema.py, line 1796, in create_all bind.create(self, checkfirst=checkfirst, tables=tables) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/engine/base.py, line 1129, in create self._run_visitor(self.dialect.schemagenerator, entity, connection=connection, **kwargs) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/engine/base.py, line 1154, in _run_visitor conn = self.contextual_connect(close_with_result=False) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/engine/base.py, line 1229, in contextual_connect return self.Connection(self, self.pool.connect(), close_with_result=close_with_result, **kwargs) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 142, in connect return _ConnectionFairy(self).checkout() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 304, in __init__ rec = self._connection_record = pool.get() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 161, in get return self.do_get() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 639, in do_get con = self.create_connection() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 122, in create_connection return _ConnectionRecord(self) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 198, in __init__ self.connection = self.__connect() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 261, in __connect connection = self.__pool._creator() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/engine/strategies.py, line 80, in connect raise exc.DBAPIError.instance(None, None, e) sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12505: TNS:listener does not currently know of SID given in connect descriptor None None -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] oracle database error.
I am using Sqlalchemy with Oracle backend in my project. I am running into listener issues with the Oracle database. Here are the steps that I am following: 1. My connection string. sqlalchemy.url=oracle://root::password@localhost:1521/orcdb 2. Environment variables . export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/ server export PATH=$PATH:$ORACLE_HOME/bin export LD_LIBRARY_PATH=$ORACLE_HOME/lib export ORACLE_SID=orc10g The following is the error that I get when my project tries to connect to the Oracle db. Traceback (most recent call last): File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/schema.py, line 1796, in create_all bind.create(self, checkfirst=checkfirst, tables=tables) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/engine/base.py, line 1129, in create self._run_visitor(self.dialect.schemagenerator, entity, connection=connection, **kwargs) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/engine/base.py, line 1154, in _run_visitor conn = self.contextual_connect(close_with_result=False) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/engine/base.py, line 1229, in contextual_connect return self.Connection(self, self.pool.connect(), close_with_result=close_with_result, **kwargs) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 142, in connect return _ConnectionFairy(self).checkout() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 304, in __init__ rec = self._connection_record = pool.get() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 161, in get return self.do_get() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 639, in do_get con = self.create_connection() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 122, in create_connection return _ConnectionRecord(self) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 198, in __init__ self.connection = self.__connect() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 261, in __connect connection = self.__pool._creator() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/engine/strategies.py, line 80, in connect raise exc.DBAPIError.instance(None, None, e) sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12505: TNS:listener does not currently know of SID given in connect descriptor None None Please give suggestions. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] database error
Am using the Oracle database to my project after setu is done i have an error ... The tracebacks are the following. File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/schema.py, line 1796, in create_all bind.create(self, checkfirst=checkfirst, tables=tables) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/engine/base.py, line 1129, in create self._run_visitor(self.dialect.schemagenerator, entity, connection=connection, **kwargs) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/engine/base.py, line 1154, in _run_visitor conn = self.contextual_connect(close_with_result=False) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/engine/base.py, line 1229, in contextual_connect return self.Connection(self, self.pool.connect(), close_with_result=close_with_result, **kwargs) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 142, in connect return _ConnectionFairy(self).checkout() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 304, in __init__ rec = self._connection_record = pool.get() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 161, in get return self.do_get() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 639, in do_get con = self.create_connection() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 122, in create_connection return _ConnectionRecord(self) File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 198, in __init__ self.connection = self.__connect() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/pool.py, line 261, in __connect connection = self.__pool._creator() File /root/tg2env/lib/python2.4/site-packages/SQLAlchemy-0.5.6- py2.4.egg/sqlalchemy/engine/strategies.py, line 80, in connect raise exc.DBAPIError.instance(None, None, e) sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12541: TNS:no listener None None My listner is working and the oracle database is connected Please make good suggestions... -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
Re: [sqlalchemy] oracle database error.
SQLPLUS shows no error . I am able to connect to oracle database. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.