expose `binary_type` in `util` module #63

Merged
merged 1 commit into from Jan 31, 2014

Projects

None yet

2 participants

@witsch
witsch commented Jan 31, 2014

it is used in sql/compiler.py(849)render_literal_value(), causing an AttributeError

@witsch witsch expose `binary_type` in `util` module
it is used in `sql/compiler.py(849)render_literal_value()`
a1f8479
@zzzeek
Owner
zzzeek commented Jan 31, 2014

ouch can you illustrate a quick test case for that? also this stuff has to all go to master first, then backported to 0.8 as a bug fix.

@witsch
witsch commented Jan 31, 2014

master/rel_0_9 are not affected. binary_type has been added there in 2709ae4, which is not part of the rel_0_8 branch:

$ git branch --remote --contains 2709ae46
  origin/HEAD -> origin/master
  origin/master
  origin/pullreq55
  origin/rel_0_9
  origin/ticket_2501

as for the test, i'll try to come up with one, but i need to get some packing done first, because we're going on a short holiday tomorrow. perhaps i'll have some time on the train... :)

@zzzeek
Owner
zzzeek commented Jan 31, 2014

guess you're using py3k with 0.8. you'd be better off running 0.9 assuming this isn't any kind of existing production system.

@zzzeek zzzeek merged commit a1f8479 into zzzeek:rel_0_8 Jan 31, 2014
@zzzeek
Owner
zzzeek commented Jan 31, 2014

just had to add tests, note everything here was broken in master as well though differently, see b360dbf

@witsch
witsch commented Feb 1, 2014

no, actually i'm using python 2.7.5 (with sqlalchemy 0.8.4).

@zzzeek
Owner
zzzeek commented Feb 1, 2014

Oh, I see the value you're passing through isn't a string or bytes at all, its some other datatype. Well the fix is in anyway thanks !

@witsch
witsch commented Feb 3, 2014

yes, the value was the tuple of enum labels i passed in my misguided fix regarding the enums. seeing that one can indeed pass an arbitrary number of arguments using the *args notation i should have used:

sizes = ('foo', 'bar', [...])
[...]
sa.Column('size', sa.Enum(*sizes, native_enum=False), nullable=True),

instead of

sizes = ('foo', 'bar', [...])
[...]
sa.Column('size', sa.Enum([sizes], native_enum=False), nullable=True),

and the supposed fix from #62.

in retrospect i'm wondering why i didn't even try that first. but at least the missing import was discovered this way... :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment