deutschmarco / sqlautocode

Automatically exported from code.google.com/p/sqlautocode
Other
0 stars 0 forks source link

Mysql Enum generates incorrect column code #22

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Generate a table with a Mysql Enum column using -g

What is the expected output? What do you see instead?

Produces column like...

Column(u'status', Enum(), primary_key=False, nullable=False)

There is no Enum() type. It should produce something like it used to (for
the same column)...

Column(u'status', String(length=8, convert_unicode=False,
assert_unicode=None), primary_key=False, nullable=False),

What version of the product are you using? On what operating system?

0.5.7 on Debian using a virtualenv with latest requirements pulled from pypi.

Please provide any additional information below.

Additionally all the other types changed from the generic types (like
String) to more database specific types like VARCHAR. While not really
breaking anything it is not an expected change.

Original issue reported on code.google.com by eiken...@gmail.com on 10 Feb 2010 at 10:57

GoogleCodeExporter commented 9 years ago
Please ignore/close this one as well. It was another sqlalchemy 6.0beta1 change 
that
caught me off guard. Sorry for the red-herrings.

Original comment by eiken...@gmail.com on 10 Feb 2010 at 11:22

GoogleCodeExporter commented 9 years ago
Actually there is a bug regarding the unexpected generic types. A patch is 
attached.

Also in case of an ENUM() field a CheckConstraint instance exists in the 
table's reflected constraints (SA 0.6.0). This is not 
valid/relevant as
a) MySQL does not support CHECK CONSTRAINT (though would not choke on it)
b) its representation is "CheckConstraint()" but CheckConstraint.__init() 
requires an argument.

This, however, is more of an SA issue than an sqlautocode issue, I guess. A 
workaround is to ignore it, just like 
sqlalchemy.PrimaryKeyConstraint.

Best,
Thomas Wiebe

Original comment by thwi...@gmail.com on 26 May 2010 at 7:05

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by spamsch@gmail.com on 30 Oct 2010 at 1:36