Open rayliverified opened 2 days ago
@xnuinside Do you have a strategy for handling Enums?
@rayliverified , hi, about enumerated - it should be generated as Python Enum, I don’t have much time this week, but maybe on weekends I can take a look and fix types. Thanks for opening the issue
Awesome to hear. I'll see if I can contribute some fixes but I don't develop in Python usually. I've never built a python library before. This library is standalone so I might give it a shot.
Mysql types aren't generated correctly.
Should the library be updated to properly parse all SQL types?
All table types
id
INT
int
tiny_int_example
TINYINT
int
small_int_example
SMALLINT
int
medium_int_example
MEDIUMINT
int
SMALLINT
.big_int_example
BIGINT
int
decimal_example
DECIMAL(10, 2)
Decimal
Decimal
for precise decimal representation.float_example
FLOAT
float
double_example
DOUBLE
float
date_example
DATE
date
datetime.date
from Python'sdatetime
module.datetime_example
DATETIME
datetime
datetime.datetime
from Python'sdatetime
module.timestamp_example
TIMESTAMP
datetime
datetime.datetime
; consider timezone awareness based on your application needs.time_example
TIME
time
datetime.time
from Python'sdatetime
module.year_example
YEAR
int
date
with only the year component.char_example
CHAR(100)
str
varchar_example
VARCHAR(255)
str
tiny_text_example
TINYTEXT
str
text_example
TEXT
str
medium_text_example
MEDIUMTEXT
str
long_text_example
LONGTEXT
str
binary_example
BINARY(16)
bytes
varbinary_example
VARBINARY(255)
bytes
tiny_blob_example
TINYBLOB
bytes
blob_example
BLOB
bytes
medium_blob_example
MEDIUMBLOB
bytes
long_blob_example
LONGBLOB
bytes
enum_example
ENUM('small', 'medium', 'large')
Enum
orLiteral
Enum
class orLiteral
fromtyping
for constrained string values.set_example
SET('A', 'B', 'C', 'D')
List[str]
orSet[str]
json_example
JSON
dict
orAny
dict
for JSON objects orAny
for more flexibility.boolean_example
TINYINT(1)
bool
0
asFalse
,1
asTrue
).point_example
POINT
tuple
or Custom Model(float, float)
) or a custom model.line_example
LINESTRING
List[tuple]
polygon_example
POLYGON
List[List[tuple]]
Unsupported types
Issues with parsing
Current output
Fixes