attached is a test program that is of a format which allows us to be able to 
answer your questions quickly.     It is a short test program that runs fully, 
using the model fragments you've sent along.

It does not reproduce your error.  Instead, it appears that the "&" is not an 
operator accepted by Oracle.   Removing the reference to '&' allows the program 
to complete successfully with both 0.6 and 0.5.8, and there is no issue with 
BLOB/pickletype.

If you can modify this attached script to reproduce your issue, that would 
communicate to us what the problem is.  OTOH if this script itself fails 
without changes, then something is up with your environment or cx_oracle 
install.





On May 18, 2010, at 5:29 AM, dhanil anupurath wrote:

> 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_TYPE            Varchar2
>        NAME                 Varchar2
>        ENTITY_ID            Varchar2
>        ENTITY_NAME          Varchar2
>        CONTEXT              Blob
>        PARAMS               Blob
>        KW_PARAMS            Blob
>        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.

-- 
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.



On May 18, 2010, at 5:29 AM, dhanil anupurath wrote:

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_TYPE            Varchar2
       NAME                 Varchar2
       ENTITY_ID            Varchar2
       ENTITY_NAME          Varchar2
       CONTEXT              Blob
       PARAMS               Blob
       KW_PARAMS            Blob
       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 sqlalchemy@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.

from sqlalchemy import *
from sqlalchemy.orm import sessionmaker, relation, backref, eagerload
from sqlalchemy.ext.declarative import declarative_base

engine = create_engine('oracle://scott:ti...@localhost/xe', echo=True)
Session = sessionmaker(engine)
Base = declarative_base()

class Task(Base):
    __tablename__ = 'tasks'

    task_id = Column(Integer,Sequence('task_id_seq'), primary_key=True)
    task_type = Column(Unicode(50), default=u'Task')
    name = Column(Unicode(256))
    context = Column(PickleType)

class TaskCalendar(Base):
    __tablename__ = 'task_calendars1'

    cal_id = Column(Integer,Sequence('taskcal_id_seq'), primary_key=True)
    task_id = Column(Integer, ForeignKey('tasks.task_id'))
    task = relation(Task, backref=backref('calendar'))
    dow = Column(Integer)

Base.metadata.drop_all(engine)
Base.metadata.create_all(engine)

sess = Session()

sess.add_all([
    Task(name='t1', context={'foo':'bar'}, 
                    calendar=[
                            TaskCalendar(dow=0), 
                            TaskCalendar(dow=2),
                            TaskCalendar(dow=5),
                            ])
])

sess.commit()

tasks=sess.query(TaskCalendar).options(eagerload('task')).\
                 filter((TaskCalendar.dow == 0) |\
                        TaskCalendar.dow.op('&')(5) > 0).all()
print tasks

Reply via email to