Description
Migrated issue, originally created by Nicolas Bur (@nbur)
Traceback (most recent call last):
print(db.table_names())
File "/home/nbur/.local/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 2139, in table_names
return self.dialect.get_table_names(conn, schema)
File "", line 2, in get_table_names
File "/home/nbur/.local/lib/python3.5/site-packages/sqlalchemy/engine/reflection.py", line 42, in cache
return fn(self, con, *args, **kw)
File "/home/nbur/.local/lib/python3.5/site-packages/sqlalchemy/dialects/mysql/base.py", line 1950, in get_table_names
if self.server_version_info < (5, 0, 2):
TypeError: unorderable types: str() < int()
As written in this log server_version_info doesn't return a tuple of three int
adding
print(self.server_version_info)
line 1950 in File "/home/nbur/.local/lib/python3.5/site-packages/sqlalchemy/dialects/mysql/base.py"
displays (5, 0, '51a', '24+lenny5') which clearly can't be compared with (5, 0, 2)…
I mention there is no problem changing and running my script with python 2.7
SQLAlchemy-1.2.2
Activity
sqlalchemy-bot commentedon Feb 16, 2018
Michael Bayer (@zzzeek) wrote:
server_version_info() doesn't have a bug here, we need those tokens to be what they are.
the bug here is that you're oddly enough using exactly a 5.0 version that is for some reason sticking a string into the third token. so this is a very unexpected and buggy version string your DB is reporting which we'd have to work around.
sqlalchemy-bot commentedon Feb 16, 2018
Changes by Michael Bayer (@zzzeek):
sqlalchemy-bot commentedon Feb 17, 2018
Nicolas Bur (@nbur) wrote:
Therefore I'm going to use python 2.7…
Thank you very much
sqlalchemy-bot commentedon Feb 17, 2018
Michael Bayer (@zzzeek) wrote:
Ok should have this fixed for next release though
sqlalchemy-bot commentedon Feb 17, 2018
Nicolas Bur (@nbur) wrote:
Great. Glad to have pointed this out :)
sqlalchemy-bot commentedon Feb 21, 2018
Changes by Michael Bayer (@zzzeek):
zzzeek commentedon Dec 22, 2018
OK so looking at other dialects, psycopg2, pymssql, cx_oracle, all of these take server version info and turn into ints for all tokens, non ints are discarded. this is what we should do here. slight doubt this doesn't break anything but I still think we should do it for 1.2.x.
blha303 commentedon Jan 2, 2019
I encountered the above bug today connecting to a legacy MySQL server with SQLAlchemy 1.2.15 (via records):
Is there an estimated time for fixing this? Thanks.
zzzeek commentedon Jan 2, 2019
@blha303 it's tagged "easy" so we usually wait for contributors to pick these up unless the issue is truly urgent. code should be made to remove non-integer tokens, so code at https://github.com/sqlalchemy/sqlalchemy/blob/master/lib/sqlalchemy/dialects/mysql/base.py#L1843 needs to look more like https://github.com/sqlalchemy/sqlalchemy/blob/master/lib/sqlalchemy/dialects/postgresql/base.py#L2446.
11 remaining items