Hi,

I have configured Turbogears and created a quick-start web site with
SQL Alchemy as the database modeler. The kid template pages where I
showed some data from the database are working perfectly. But the part
of the controller where I am trying to do an INSERT into a table of my
oracle database using the values of the bind variables of a remote
form that I have shown, is not working.

Apparently there is some problem with the UNICODE data that 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.

I furnish below all the code parts related to the issue and any kind
help is appreciated.

Regards

Ravi

--- FROM TURBOGEARS ---
The method in the controller which is in-charge of doing the INSERT
into the database using the received parameters

def add(self, _name, _email, _text, _somedate, *args):
        #ins_comment = model.comments_table.insert().execute(name="Ravi",
email="[EMAIL PROTECTED]", text="Some Text") ---> This worked 100%
inserting the row into the table.

        print _name, _email, _text, _somedate ---> This prints the values
correclty

        ins_comment = model.comments_table.insert().execute(email=_email,
name=_name, text=_text) ---> This is not doing the insert into the
oracle table correctly but throwing the following error.

SQLError: (NotSupportedError) Variable_TypeByValue(): unhandled data
type unicode 'INSERT INTO comments (email, name, text) VALUES
(:email, :name, :text)' {'text': u'This is a comment', 'email':
u'[EMAIL PROTECTED]', 'name': u'Ravi'}

--- FROM PYTHON CLI ---

Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from sqlalchemy import *
>>> db = create_engine('oracle://scott:[EMAIL PROTECTED]')
>>> metadata = BoundMetaData(db)
>>> comments_table = Table("comments", metadata, autoload=True)
>>> v_email='[EMAIL PROTECTED]'
>>> v_name='Ravi Kasibhatla'
>>> v_text='This is a comment from Python CLI'
>>> ins = comments_table.insert()
>>> ins.execute(email=v_email, name=v_name, text=v_text)
<sqlalchemy.engine.base.ResultProxy object at 0x00D503D0>
>>> sel = comments_table.select()
>>> rows = sel.execute()
>>> print rows.fetchall()
[('[EMAIL PROTECTED]', 'Ravi Kasibhatla', 'This is a comment from
Python CLI', datetime.datetime(2007, 4, 25, 11, 24, 13))]

 AS YOU CAN SEE, THE INSERT WAS SUCCESSFUL


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

Reply via email to