Skip to content

Fixed #18757, #14462, #21565 -- Reworked database-python type conversions - #3047

Closed
mjtamlyn wants to merge 1 commit into
django:masterfrom
mjtamlyn:ticket18757
Closed

mjtamlyn wants to merge 1 commit into
django:masterfrom
mjtamlyn:ticket18757

Conversation

@mjtamlyn

Copy link
Copy Markdown
Member

Make resolve_columns a permanent fixture, remove convert_values.

Current implementation passes on sqlite at least, but does destroy performance. Need a nicer converter-collection based approach. Also some tests that we can use the new override from_db_value, and that #21565 is fixed in the process.

  • Make the tests pass
  • Refactor to use "convertor-collector" based system
  • Add tests for #21565
  • Add tests for #14462
  • Add documentation for from_db_value and appropriate test suite for it

@mjtamlyn

Copy link
Copy Markdown
Member Author

Woo! We have a green light. http://djangoci.com/job/django-pull-requests/738/

Updating the description with the current todo list.

@mjtamlyn mjtamlyn changed the title [wip] POC for #18757. Fixed #18757, #14462, #21565 -- Reworked database-python type conversions Aug 19, 2014
Comment thread django/db/models/fields/subclassing.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Field.from_db_value()

Comment thread django/db/backends/oracle/base.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

append(...), not append[...].

@mjtamlyn

Copy link
Copy Markdown
Member Author

Status update:

I've now got djangobench reporting no more than a 1.1x slowdown on any benchmark, with most running the same. There is basically no change in the performance on any standard benchmark. There will be a performance hit when resolve_columns is run, but on mysql at least this will now happen less often than it used to so a net win.

Documentation has been all tidied up as per @timgraham's comments.

I have some issues with some other databases which the CI server is finding which I should hopefully be able to pin down tomorrow morning. Once these are resolved we should be good to merge.

Any comments @akaariai?

@mjtamlyn

Copy link
Copy Markdown
Member Author

The CI is very flaky this morning... The most recent test run has a few configurations which died out due to failed checkouts, and some of the Oracle builds refused connections.

The one oracle build which worked - http://djangoci.com/job/django-pull-requests/814/database=oracle11,python=python2.7/console - seems to have a bunch of errors which I know I fixed in 86c2404, as well as a strange collection of unrelated failures largely seeming to result from a language leak. I guess this might happen where some other test is failing.

I'm going to try to retrigger the build and see if it is any happier second time round.

Comment thread docs/howto/custom-model-fields.txt Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comma after aggregation
"it has" on next line

@shaib

shaib commented Aug 27, 2014

Copy link
Copy Markdown
Member

Great work, overall. The amount of clean-up is impressive.

One optimization proposal: it seems that connection.get_db_converters(self, internal_type) would benefit from memoizing, or even explicitly building a dictionary internal_type->converter_list for all the core internal_types.

Comment thread django/db/backends/oracle/compiler.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SELECT * FROM (SELECT "_SUB".*, ROWNUM AS "_RN" FROM (%s) "_SUB" %s) WHERE ...

(ROWNUM AS "_RN" should be part of the SELECT clause, not FROM clause).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants