On Fri, Feb 8, 2013, at 15:49, Michael Bayer wrote:
> 
> On Feb 8, 2013, at 5:47 AM, Thijs Engels wrote:
> 
> > 
> > Running this script on 3.3 results in this error message:
> > 
> > sqlalchemy.exc.IntegrityError: (IntegrityError) ORA-01400: cannot insert
> > NULL into ("SCOTT"."USERS"."ID")
> > 'INSERT INTO users (id, name, extra) VALUES (:id, :name, :extra)'
> > {'extra': 2013, 'name': 'Ed Jones', 'id': 2}
> > 
> > (more details available at request)
> > 
> > This seems odd, as the insert statement indicates the column id is
> > assigned with a correct value (2).
> > 
> > Same script, again Python 3, but now with SQLite (in memory): no errors.
> > Using Python 2 (v2.7.3) and Oracle; again no errors.
> > 
> > Is it correct to assume this would be related to SQLAlchemy?
> 
> I've not attempted running cx_oracle itself with Python 3 at all, and
> haven't made any attempt to test SQLAlchemy's dialect with python 3 +
> cx_Oracle.
> 
> What happens if you run a plain cx_Oracle script in Python 3 that runs
> the equivalent statement, that is,
> 
> 
> import cx_Oracle
> conn = cx_Oracle.connect(username, password, dsn)
> cursor = conn.cursor()
> cursor.execute("insert into users (id, name, extra) values (:id, :name,
> :extra)", {"extra":2013, "name": "Ed Jones", "id": 2})

I knew that question was coming; I forgot to mentioned in my original
email that I did try this:

-----
import cx_Oracle

connection = cx_Oracle.Connection("scott/tiger@localhost:1521/xe")
cursor = connection.cursor()

cursor.prepare("INSERT INTO users (id, name, extra) VALUES (:id, :name,
:extra)")
cursor.execute(None, {'extra': 2013, 'id': 2, 'name': 'Ed Jones'})

connection.commit()
-----

Works fine with both Python 2.7 and 3.3. Running the (even more) direct
statement as in your email end up with the same results.

More than willing to try things out if the feedback on this is
considered useful.

Thijs

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to