#5461 - Refactoring of database backends for creation, etc

View: New views
4 Messages — Rating Filter:   Alert me  

#5461 - Refactoring of database backends for creation, etc

by Russell Keith-Magee-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi all,

I've just uploaded an updated patch for ticket #5461 [1].

This is really a follow on from two older tickets - The database
backend refactoring (#5106 [2]) and the recent database type
refactoring (#7560 [3]). The patch isn't strictly required, but given
we are aiming for API stability, it makes sense to me that we should
finalize the database API so that it uses a consistent approach for
all operations.

r6192 [4] added an empty skeleton for the creation part of this work;
this patch finishes the job.

I've tested on sqlite3, mysql and postgres_psycopg2. This leaves the
oracle backend and base postgres.

At this point, I'm looking for:

 * Testing and validation for Oracle and psyco1. Psycopg1 is mostly
tested by virtue of the postgres_psycopg2 testing, but there is one
subtle difference, so I'd like some independent validation

 * Any other feedback on the approach taken by the patch.

Yours,
Russ Magee %-)

[1] http://code.djangoproject.com/ticket/5461
[2] http://code.djangoproject.com/ticket/5106
[3] http://code.djangoproject.com/ticket/7560
[4] http://code.djangoproject.com/changeset/6192

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to django-developers@...
To unsubscribe from this group, send email to django-developers+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: #5461 - Refactoring of database backends for creation, etc

by Ivan Illarionov :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Looks great to me.

I have further proposals for database backends refactoring:
* Move all the functions from django.core.management.sql to the
BaseCreation class and let backends change its behavior.
* Create django/db/backends/validation.py with BaseValidation class
* Move all the functions from django.core.management.validation to the
BaseValidation class.
* Add new validation attribute to connection and move all backend-
specific validation (like 255 max_length MySQL limit) to these
backends.

This would finally remove all scary `if settings.DATABASE_ENGINE`
checks and  replace many `if connection.features.*` with nice
consistent OO design. External developers can't add new database
features to support various RDBMS quirks (and there are many) so this
will make writing external backends possible without patching Django.

If this (or part of it) looks interesting I can write a patch.

Regards,
Ivan Illarionov
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to django-developers@...
To unsubscribe from this group, send email to django-developers+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: #5461 - Refactoring of database backends for creation, etc

by Leo Soto M. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Thu, Jul 31, 2008 at 9:14 AM, Russell Keith-Magee
<freakboy3742@...> wrote:
>
> Hi all,
>
> I've just uploaded an updated patch for ticket #5461 [1].

Great!

I just adapted the code of Jython backends to this patch and getting
rid of all the duplication on the introspection modules feels good.
--
Leo Soto M.
http://blog.leosoto.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to django-developers@...
To unsubscribe from this group, send email to django-developers+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: #5461 - Refactoring of database backends for creation, etc

by Alex Gaynor :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I like the suggestion of moving the db table creation stuff to also be
in django.db.backends, this is, as Ivan says, more OO and cohesive,
plus it seems like the better place to go.  That would also make sense
in the context of schema evolution, if that were to ever make it's way
into django(as opposed to via 3rd party projects).

On Jul 31, 1:12 pm, Ivan Illarionov <ivan.illario...@...> wrote:

> Looks great to me.
>
> I have further proposals for database backends refactoring:
> * Move all the functions from django.core.management.sql to the
> BaseCreation class and let backends change its behavior.
> * Create django/db/backends/validation.py with BaseValidation class
> * Move all the functions from django.core.management.validation to the
> BaseValidation class.
> * Add new validation attribute to connection and move all backend-
> specific validation (like 255 max_length MySQL limit) to these
> backends.
>
> This would finally remove all scary `if settings.DATABASE_ENGINE`
> checks and  replace many `if connection.features.*` with nice
> consistent OO design. External developers can't add new database
> features to support various RDBMS quirks (and there are many) so this
> will make writing external backends possible without patching Django.
>
> If this (or part of it) looks interesting I can write a patch.
>
> Regards,
> Ivan Illarionov
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to django-developers@...
To unsubscribe from this group, send email to django-developers+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

LightInTheBox - Buy quality products at wholesale price!