this has been fixed in 0.7, however it is completely a mystery how the change got in there, and it doesn't have test coverage. I'm thinking perhaps someone on IRC handed me a patch or something and I forgot it was there since it was committed along with something not really related:
http://www.sqlalchemy.org/trac/changeset/7154#file5 so that's your patch, if you want to provide tests we can also backport to 0.6. The actual change is a two liner. On Feb 22, 2011, at 8:54 PM, Rami Chowdhury wrote: > Hi, > > We're using PostgreSQL's BIT type to store bit-strings > (http://www.postgresql.org/docs/current/static/datatype-bit.html), and (at > least as of SQLA 0.6.6) the PostgreSQL dialect's BIT type doesn't seem to > support those kinds of fields -- it just issues "BIT" when creating the > tables, and we get 1-bit fields! At the moment (for table creation at least) > we're getting around this using the following: > > > class PG_BIT(sqlalchemy.dialects.postgresql.BIT): > > > def __init__(self, length=None, *args, **kw): > > > # Takes one positional arg, the bit length. Can be omitted > > > self._bit_length = length > > > > > @sqlalchemy.ext.compiler.compiles(PG_BIT) > > > def compile_PG_BIT(element, compiler, **kw): > > > if element._bit_length: > > > return "BIT(%d)" % element._bit_length > > > else: > > > return compiler.visit_BIT(element, **kw) > > > and using PG_BIT everywhere we'd want to use BIT. Obviously, though, it'd be > great if SQLAlchemy supported this better. I'm very happy to try and work up > a patch myself, but I'd appreciate advice on : > - what I should try to patch (postgresql.BIT and > postgresql.base.PGTypeCompiler are my first guesses) > - what kind of coding / testing practices I should observe > - should I try and write a patch against hg tip? against the 0.6.6 release? > - is there anything I'm missing? > > Thanks! > Rami > > -- > Rami Chowdhury > "Never assume malice when stupidity will suffice." -- Hanlon's Razor > +44-7581-430-517 / +1-408-597-7068 / +88-0189-245544 > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to sqlalchemy@googlegroups.com. > To unsubscribe from this group, send email to > sqlalchemy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.