Skip to content
This repository has been archived by the owner on Dec 18, 2018. It is now read-only.

Minimum working example of ORA-12704 errors with nullable Django Decimal fields

License

Notifications You must be signed in to change notification settings

UT-Austin-FIS/dueling_decimals

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dueling_decimals

Minimum working example of ORA-12704 errors encountered while bulk-creating nullable Django Decimal fields.

Failing Tests:

The problem that spawned this repo is that the following tests failed under Django 1.7.1 and cx_Oracle 5.1.3. They now pass, due to how the test is structured (if ORA-12704 was expected and raised, the test passes).

  • test_different_fields_set_decimal
  • test_different_fields_set_unicode
  • test_different_fields_set_with_batch_size_2
  • test_different_fields_set_with_batch_size_35
  • test_one_field_set

Test failures by Django version

Number of passing tests by version of Django, all with cx_Oracle==5.1.3, since that's the only one available from PyPI.

python Django # failing convert_unicode
2.7.9 1.4.12 0/19 smart_str
2.7.9 1.4.18 0/19 smart_str
2.7.9 1.5.0 5/19 force_text
2.7.9 1.5.12 5/19 force_text
2.7.9 1.6.10 5/19 force_text
2.7.9 1.7.1 5/19 force_text
3.4.2 1.7.1 0/19 force_text

So, it looks like the problem lies in a change made between 1.4 and 1.5...

Related Django Issues

Setup:

Create a new Oracle 11gR2 schema to run tests against. Installing cx_Oracle requires a local Oracle installation, which the PyPE 27.7.0 VM provides.

Continue on, either with PyPE or virtualenv.

PyPE (the UT-specific Django environment)

If you're using the 27.7.0 VM...

$ cd /pype
$ git clone github.com/UT-Austin-FIS/dueling_decimals.git
$ export PYTHONPATH=$PYTHONPATH:/pype/dueling_decimals
$ cp dueling_decimals/{_local_settings_template.py,local_settings.py}
$ nano dueling_decimals/local_settings.py  # update DATABASES
$ python manage.py test dummy

virtualenv

You need an Oracle installation on your code-executing machine to make connections to your Oracle database. I'm going to use Oracle Instant Client. Note that this requires creating an account on oracle.com and agreeing to their license terms.

Choose your host architecture on the page linked above, agree to the license terms if you dare, and download the "Basic" and "SDK" zip files that correspond to the version of Oracle you're connecting to. If you need to know what version of Oracle you're connecting to, try running this SQL statement:

SELECT * FROM V$VERSION;

Follow the installation instructions at the bottom of listing page, including creating symlinks and setting up ORACLE_HOME and LD_LIBRARY_PATH.

This might also help: https://gist.github.com/hangtwenty/5547377, though I didn't need it, other than to know that the "Basic" and "SDK" downloads are both needed.

Now, you should be able to install cx_Oracle as part of the overall installation:

$ git clone github.com/UT-Austin-FIS/dueling_decimals.git
$ cp dueling_decimals/{_local_settings_template.py,local_settings.py}
$ nano dueling_decimals/local_settings.py  # update DATABASES
$ virtualenv venv  # python2.7
$ source venv/bin/activate
(venv) $ pip install -r requirements.txt
(venv) $ ./manage.py test dummy

About

Minimum working example of ORA-12704 errors with nullable Django Decimal fields

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages