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
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
Good suggestions, all. I've just uploaded a patch that implements the
changes you suggest. Feedback welcome.
Yours,
Russ Magee %-)
Had noted the same detail and I agree. A small obvious correction though: With
Russell's latest patch (5461-r8194.diff) the problem is in lines 19 and 20.
Another minor related modification I'd suggest is to show the error message
when importing the external DB backend has failed simply by printing e_user.
This has proven to be helpful when coding and testing a backend and could be of
help to people when setting up their PYTHONPATH to use it.
I'm attaching now to the ticket an updated patch (5461-r8194.2.diff) implemen-
ting these two suggestions.
Regards,
--
Ramiro Morales
I originally considered this, but decided against it.
core.management.sql contains some logic that is pretty closely tied to
the way models are interpreted, and there is almost nothing backend
specific about that logic. I settled on keeping the SQL specific calls
in the backend, and everything else where it is currently.
> * make parent connection an attribute of BaseDatabaseCreation,
> importing connection inside methods of connection.creation makes
> little sense.
A nice idea, but not as easy as it sounds. The backend modules are
constructed as class members, not instance members.
> * remove `support_constraints` feature and instead just override
> * `supports_tablespaces` could be replaced by overriding
> * `inline_fk_references` could be replaced by overriding
One of the biggest unresolved issues with this patch is the overlap
between a fully OO database backend and the 'features' class on the
backend. Most of what is currently stored as 'features' could be
implemented as function overloading in an object-based interface.
Going down this path will require a fair bit of refactoring, so I'm
waiting on some feedback from the other core developers before I do
too much more work on this particular area.
> * make `style` another property of creation object instead of passing
> it as argument.
I'm not sure this is the right thing to do. The output style isn't a
database specific thing, and it isn't consistent across all uses.
Russ %-)