hey nis, 1) psycopg2 has been added as a backend
2-4) the other three bugs i've verified and fixed in svn. (plus i've started a new "everything" test case to check all the field types from now on) > I think the introspection code for postgres can be tightened a lot - > especially if we limit ourselves to versions >=7.4 - I am happy to help > in this area. i'll take any suggestions you have. :) thanks, derek Nis Jørgensen wrote: > Derek Anderson skrev: >> Django External Schema Evolution Branch >> ======================================= >> http://code.google.com/p/deseb/ >> >> I've released v0.2, which supports both MySQL and Postgresql, and works >> with both django-head and django-v0.96. >> >> This release contains the introspection/generation code only. The >> "schema signing/fingerprinting" and "managed schema updates" have yet to >> be ported. >> >> Installation is dead simple. Download and extract it into your >> site-packages dir, and add "import deseb" to settings.py. >> >> If you have an interest, please give it a whirl and send me feedback. >> (either privately or here, I don't care) But please, restrain from >> publicly flogging it/me until AFTER you've actually used it. =p >> > I am now running into my fourth problem needing fixing before I can > "actually use it". I have no more time for this now - but I am happy to > help later. > > First problem: > > psycopg2 is not supported > > First fix: > > --- deseb/schema_evolution.py 2007-09-30 21:06:17.000000000 +0000 > +++ /usr/lib/python2.4/site-packages/deseb/schema_evolution.py > 2007-10-02 08:08:00.000000000 +0000 > @@ -29,8 +29,10 @@ > > backend_type = str(connection.__class__).split('.')[3] > if backend_type=='mysql': import deseb.backends.mysql as backend > - if backend_type=='postgresql': import deseb.backends.postgresql as > backend > - if backend_type=='sqlite3': import deseb.backends.sqlite3 as backend > + elif backend_type in ['postgresql', 'postgresql_psycopg2']: import > deseb.backends.postgresql as backend > + elif backend_type=='sqlite3': import deseb.backends.sqlite3 as backend > + else: > + raise Exception('Backend not supported') # This should raise a > more relevant exception > ops = backend.DatabaseOperations(connection, style) > introspection = backend.DatabaseIntrospection(connection) > return ops, introspection > > Second problem: > Unknown function ops.quote_name > > Second fix: > > (this may not be how it was intended to work) > > --- deseb/schema_evolution.py 2007-09-30 21:06:17.000000000 +0000 > +++ /usr/lib/python2.4/site-packages/deseb/schema_evolution.py > 2007-10-02 08:08:00.000000000 +0000 > @@ -409,8 +411,8 @@ > if f.rel: > if f.rel.to in known_models: > field_output.append(style.SQL_KEYWORD('REFERENCES') + ' > ' + \ > - > style.SQL_TABLE(ops.quote_name(f.rel.to._meta.db_table)) + ' (' + \ > - > style.SQL_FIELD(ops.quote_name(f.rel.to._meta.get_field(f.rel.field_name).column)) > + ')' #+ > + > style.SQL_TABLE(connection.ops.quote_name(f.rel.to._meta.db_table)) + ' > (' + \ > + > style.SQL_FIELD(connection.ops.quote_name(f.rel.to._meta.get_field(f.rel.field_name).column)) > + ')' #+ > # backend.get_deferrable_sql() > ) > else: > > Third problem: > > Default values are not always strings: > > File "/usr/lib/python2.4/site-packages/deseb/backends/postgresql.py", > line 126, in get_known_column_flags > dict['default'] = row[1][1:row[1].index("'",1)] > ValueError: substring not found > > Fix: > > (more problems are likely to exist for other data types - but at least I > get past the error) > > Only in /usr/lib/python2.4/site-packages/deseb/backends: __init__.pyc > diff -u -r deseb/backends/postgresql.py > /usr/lib/python2.4/site-packages/deseb/backends/postgresql.py > --- deseb/backends/postgresql.py 2007-09-30 02:28:43.000000000 +0000 > +++ /usr/lib/python2.4/site-packages/deseb/backends/postgresql.py > 2007-10-02 08:28:06.000000000 +0000 > @@ -122,7 +122,10 @@ > for row in cursor.fetchall(): > if row[0] == column_name: > if row[1][0:7] == 'nextval': continue > - dict['default'] = row[1][1:row[1].index("'",1)] > + if row[1][0] == "'": > + dict['default'] = row[1][1:row[1].index("'",1)] > + else: > + dict['default'] = row[1] > > # print table_name, column_name, dict > return dict > > > > Fourth problem: > > File "/usr/lib/python2.4/site-packages/deseb/schema_evolution.py", line > 210, in get_sql_evolution_check_for_dead_fields > suspect_fields.discard(f.aka) > AttributeError: 'TextField' object has no attribute 'aka' > > Fix: > > ??? > > I think the introspection code for postgres can be tightened a lot - > especially if we limit ourselves to versions >=7.4 - I am happy to help > in this area. > > Nis > > > > -- looking to buy or sell anything? try: http://allurstuff.com it's a classified ads service that shows on a map where the seller is (think craigslist + google maps) plus it's 100% free :) --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---