On Oct 7, 9:21 pm, Taavi Burns <taavi.bu...@gmail.com> wrote:
> We use reflection to generate base declarative class definitions of
> our tables, and I'm working on porting from SQLAlchemy 0.5 to 0.6.
> TIMESTAMP column reflection was quite a bit fishy in 0.5, and is
> overall better in 0.6.  Still, I found a bug while roundtripping(*)
> the whole shebang.  Looks like a typo in the MySQL dialect regexp. :)
>
> https://bitbucket.org/taavi_burns/sqlalchemy/changeset/73d2d5673e01
>
> I think there's also a glitch in TINYINT(1) handling, which the docs
> say should come out as a Boolean().  Except that the docs also say
> that 0.6 tries to return the most specific type available, which
> should be TINYINT(1) and not Boolean(); so I'm not sure which is more
> "correct". :)  Right now I've got our code looking for TINYINT(1)
> specifically and forcing to Boolean(), because I know that's what we
> want.

http://groups.google.com/group/sqlalchemy/browse_thread/thread/b9c020804456f066/c0a817c7f2133bbe

I had grumbled that mapping tinyint(1) to bool was an issue for people
who were simply trying to process small integers.  I had no idea that
some people used that as a convention for indicating a boolean field
in MySQL.

Since 1 == True and 0 == False, an integer field will behave like a
bool for people who simply code with boolean values.
>
> (*) Because I'm paranoid, I've got tests that:
> 1. Issue a CREATE TABLE, then SHOW CREATE TABLE and save the output
> 2. Get SQLA to reflect that table, drop it, re-create from SQLA, and
> SHOW CREATE TABLE again
> 3. Generate the base declarative class, exec that code, drop the
> table, create it from the base declarative, and SHOW CREATE TABLE a
> third time
> 4. Make sure all 3 SHOW CREATE TABLE statements are identical. :)
>
> It's a lot of work, but I'm now much more confident that the schema we
> think we're using is the one we're actually using.
>
> Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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.

Reply via email to