On 21.02.2006., at 06:12, Michael Bayer wrote:
great. you really thought it all!
actually i didnt think of this, it was a trac ticket first posted
by Jason Pellerin who also implemented the ProxyEngine.
ah I was fooled by the zzzeek seen in the svn blame for the oldest
revision for proxy.py
well its Python and I had observed a lot of libraries do have a lot
of module-level stuff going on....i didnt want to make it too J2EE-
ish !
of course, nobody wants javish stuff :-), but I always considered
this python "feature" a major problem because it leads to stuff like
import mapper as mapperlib etc
and also because sometimes one needs to import using "import
package.module" and then use module.function
and other times "from package.module import Class" ... Class.method,
which imho is less consistent.
But as I said the important thing is to code correctly, this are
details.
oids are not too important a feature, mostly because their support
is spotty not only in postgres but also mysql is a little flaky
about them too. theyre only used as a "default sorting" for
mappers, when available.
the problem that I see with postgres and alike is that the oid is
globally unique and this can lead to uncontrolled wrap around.
On the other hand a rowid like oracle does not suffer from the same
problem (althrough it suffers from other problems like changing with
flashback etc).
So neither can be used as a primary key but rowids can be used to
quickly access the last inserted row which from what i've understood
from another thread was needed in sqlalchemy in order to manipulate
tables without pk. not that I'm advocating for this coding style, but
it could happen,
you never know.. I just finished writing a zope frontend for a
severlal k$ voip software wich used a mssql db with no ref integrity
and some tables without primary keys....it hurted.
Or simply the comment in proxy.py is outdated and effectively the
method will be called when an engine is present ?
without trying it, seems like it should work. so maybe ? i try to
leave most testing of the external modules to external resources :)
ehe. trying this I found a bug with relationships and the proxy. i'm
struggling with it now. I'm happy to find a bug otherwise it's
boring.. :-)
youll have to show me an example of what you mean.
nothing important if the oids are not important. but however I ment:
def _oid_col(self):
# OID remains a little hackish so far
if not hasattr(self, '_oid_column'):
if self.table.engine.oid_column_name() is not None:
for example this should be
if self.table.use_oids():
class Table(...):
def __init__(....):
[...]
self._use_oids = kwargs.get(_use_oids)
[...]
def use_oids(self):
if self._use_oids is None:
return self.engine.use_oids # or something nicer than
a three state logic which in python is error prone
return self._use_oids
The other thing is about putting together common things shared
between various database backends.
It's more a design issue than techinical. Because from one view point
it would be nice to put common code in superclasses, grouping by
dialect
(like for exampel types, both sqllite and postgres actually format
many types exacly the same way; or for example the naming of the
"oid" field etc)
but on the other hand maybe it's better to have every backend self
contained and moving only ansi stuff in a superclass (like varchar
formatting etc, but not the oid stuff)
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users