[sqlalchemy] Re: Tiny doc clarification request
On Thursday, November 8, 2018 at 12:45:57 PM UTC-5, Lele Gaifax wrote: > > But maybe I'm missing some detail on the "engine specific" > implementations, > where, say, "foo['string']" may be considered a very different operation > than > "bar[2]"... > Well that also has to do with whatever the object is foo = {'string': value} vs bar = [1,2,3,4,5] if you had in Python: foo = {'string': None, 2: 'two'} it should encode to json where the key is a string: '{"2": "two", "string": null}' With that being stated, I have no idea what happens in SqlAlchemy or the various engines if you try to set `bar[2] = "two"'` when `bar` is a hash/dict/object. something might raise an error, or `2` might be retyped into the string `"2"`, or a database might possibly support an int as an object key (I have no idea if any of these happen, just rambling on potential compatibility points). -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
Re: [sqlalchemy] Refactoring events / triggers into Mixins
It was an error from my hardcoded ddl statement not matching the resulting Class.__tablename__. So the error was from the database. No issues with sqlalchemy at all. The resulting Mixin does what I expect. Thanks again for your incredible dedication on this listserv and with open source. - Luke -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
[sqlalchemy] Re: Tiny doc clarification request
Jonathan Vanasco writes: > is the list operation nested? > > i.e. the example states: > >- > >data_table.c.data[('key_1', 'key_2', 5, ..., 'key_n')] > > > does that correspond to: > > ['key_1']['key_2']['5']['...']['key_n'] = foo > > > If so, it might make sense to call the first two "toplevel index > operations, by key or integer" and the latter "nested path operations". Yes, that's how I "parsed" it: basically, the "two" distinct operations I see are a) simple "direct" lookup, be it either by string or by integer b) "iterative"/"nested" lookup, one hop at a time over the provided sequence But maybe I'm missing some detail on the "engine specific" implementations, where, say, "foo['string']" may be considered a very different operation than "bar[2]"... ciao, lele. -- nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia. l...@metapensiero.it | -- Fortunato Depero, 1929. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
Re: [sqlalchemy] Tiny doc clarification request
is the list operation nested? i.e. the example states: - data_table.c.data[('key_1', 'key_2', 5, ..., 'key_n')] does that correspond to: ['key_1']['key_2']['5']['...']['key_n'] = foo If so, it might make sense to call the first two "toplevel index operations, by key or integer" and the latter "nested path operations". -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
Re: [sqlalchemy] Tiny doc clarification request
the two "index" operations apply to two different datatypes, hash and list, is it having "key' / "integer" both called "index" operations that is confusing? On Thu, Nov 8, 2018 at 11:29 AM Lele Gaifax wrote: > > Hi, > > in the basic JSON type docstring I see: > > The base :class:`.types.JSON` provides these two operations: > > * Keyed index operations:: > > data_table.c.data['some key'] > > * Integer index operations:: > > data_table.c.data[3] > > * Path index operations:: > > data_table.c.data[('key_1', 'key_2', 5, ..., 'key_n')] > > and I was about to open a PR with a solution, but a doubt chimed in. > > Does it mean something like the following: > > The base :class:`.types.JSON` provides these two operations: > > * Keyed index operations, either by string as in > > :: > > data_table.c.data['some key'] > > or positional/by integer:: > > data_table.c.data[3] > > * Path index operations:: > > data_table.c.data[('key_1', 'key_2', 5, ..., 'key_n')] > > or is it just a s/two operations/three operations/ ? > > Thanks, lele. > -- > nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri > real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia. > l...@metapensiero.it | -- Fortunato Depero, 1929. > > -- > SQLAlchemy - > The Python SQL Toolkit and Object Relational Mapper > > http://www.sqlalchemy.org/ > > To post example code, please provide an MCVE: Minimal, Complete, and > Verifiable Example. See http://stackoverflow.com/help/mcve for a full > description. > --- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sqlalchemy+unsubscr...@googlegroups.com. > To post to this group, send email to sqlalchemy@googlegroups.com. > Visit this group at https://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/d/optout. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
Re: [sqlalchemy] Proper way to handle new 128 character identifier limit in Oracle >= 12.2
On Thu, Nov 8, 2018 at 11:23 AM 'Van Klaveren, Brian N.' via sqlalchemy wrote: > > Hi, > > Oracle 12.2 now allows 128 character length identifiers: > > https://docs.oracle.com/en/database/oracle/oracle-database/12.2/newft/new-features.html#GUID-64283AD6-0939-47B0-856E-5E9255D7246B > > It'd be great if sqlalchemy knew about this, but what's the proper way of > handling this? Just use the existing dialect and monkey patch > max_identifier_length or create a new dialect? for now monkeypatch, and for the fix, we would need to look at the server version info and modify the variable accordingly, here: https://github.com/zzzeek/sqlalchemy/blob/master/lib/sqlalchemy/dialects/oracle/base.py#L1087 Pull requests welcome on this or at least we can create an issue in bitbucket to track this. > > Thanks, > Brian > > > -- > SQLAlchemy - > The Python SQL Toolkit and Object Relational Mapper > > http://www.sqlalchemy.org/ > > To post example code, please provide an MCVE: Minimal, Complete, and > Verifiable Example. See http://stackoverflow.com/help/mcve for a full > description. > --- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sqlalchemy+unsubscr...@googlegroups.com. > To post to this group, send email to sqlalchemy@googlegroups.com. > Visit this group at https://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/d/optout. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
[sqlalchemy] Tiny doc clarification request
Hi, in the basic JSON type docstring I see: The base :class:`.types.JSON` provides these two operations: * Keyed index operations:: data_table.c.data['some key'] * Integer index operations:: data_table.c.data[3] * Path index operations:: data_table.c.data[('key_1', 'key_2', 5, ..., 'key_n')] and I was about to open a PR with a solution, but a doubt chimed in. Does it mean something like the following: The base :class:`.types.JSON` provides these two operations: * Keyed index operations, either by string as in :: data_table.c.data['some key'] or positional/by integer:: data_table.c.data[3] * Path index operations:: data_table.c.data[('key_1', 'key_2', 5, ..., 'key_n')] or is it just a s/two operations/three operations/ ? Thanks, lele. -- nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia. l...@metapensiero.it | -- Fortunato Depero, 1929. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
[sqlalchemy] Proper way to handle new 128 character identifier limit in Oracle >= 12.2
Hi, Oracle 12.2 now allows 128 character length identifiers: https://docs.oracle.com/en/database/oracle/oracle-database/12.2/newft/new-features.html#GUID-64283AD6-0939-47B0-856E-5E9255D7246B It'd be great if sqlalchemy knew about this, but what's the proper way of handling this? Just use the existing dialect and monkey patch max_identifier_length or create a new dialect? Thanks, Brian -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
Re: [sqlalchemy] Problem with Alembic autogenerate after updating to 1.0.2
What operating system platform are you on ? can you run this for me please? MariaDB [(none)]> show variables like 'lower_case_table_names'; ++---+ | Variable_name | Value | ++---+ | lower_case_table_names | 0 | ++---+ 1 row in set (0.00 sec) On Thu, Nov 8, 2018 at 10:10 AM Mike Bayer wrote: > > easier, if you can give me a "SHOW CREATE TABLE" for a table here that > has foreign key constraints and refers to a column named "id", "ID", > "iD", something with those two letters in it. > On Thu, Nov 8, 2018 at 9:58 AM Mike Bayer wrote: > > > > On Thu, Nov 8, 2018 at 9:56 AM Mike Bayer wrote: > > > > > > On Thu, Nov 8, 2018 at 3:36 AM wrote: > > > > > > > > Hi > > > > > > > > I had a problem with alembic autogenerate after updating to version > > > > 1.0.2. I'm running MySQL 8.0.11 and Python 3.7.1 > > > > No matter how my base is defined, I always get the same error. I went > > > > through the error and found out it comes from function " > > > > > > Did you also update SQLAlchemy version? The check you see has to do > > > with SQLAlchemy version 1.2.13. Can you confirm that using SQLAlchemy > > > 1.2.12 resolves the issue? I can work towards making this check more > > > defensive. Additionally let me run the tests on MySQL 8 to see if > > > I'm missing something. > > > > no failures here, can you please provide a sample database model that > > produces this error? > > > > > > > > > > > > > > > > _correct_for_mysql_bug_88718(self, fkeys, connection)" in module > > > > "base.py" with this explaination: > > > > > > > > # Foreign key is always in lower case (MySQL 8.0) > > > > # https://bugs.mysql.com/bug.php?id=88718 > > > > # issue #4344 for SQLAlchemy > > > > > > > > > > > > This is log of error: > > > > > > > > INFO [alembic.runtime.migration] Context impl MySQLImpl. > > > > INFO [alembic.runtime.migration] Will assume non-transactional DDL. > > > > Traceback (most recent call last): > > > > File "---/venv/bin/alembic", line 11, in > > > > load_entry_point('alembic==1.0.2', 'console_scripts', 'alembic')() > > > > File "---/venv/lib/python3.7/site-packages/alembic/config.py", line > > > > 502, in main > > > > CommandLine(prog=prog).main(argv=argv) > > > > File "---/venv/lib/python3.7/site-packages/alembic/config.py", line > > > > 496, in main > > > > self.run_cmd(cfg, options) > > > > File "---/venv/lib/python3.7/site-packages/alembic/config.py", line > > > > 479, in run_cmd > > > > **dict((k, getattr(options, k, None)) for k in kwarg) > > > > File "---/venv/lib/python3.7/site-packages/alembic/command.py", line > > > > 176, in revision > > > > script_directory.run_env() > > > > File "---/venv/lib/python3.7/site-packages/alembic/script/base.py", > > > > line 427, in run_env > > > > util.load_python_file(self.dir, 'env.py') > > > > File "---/venv/lib/python3.7/site-packages/alembic/util/pyfiles.py", > > > > line 81, in load_python_file > > > > module = load_module_py(module_id, path) > > > > File "---/venv/lib/python3.7/site-packages/alembic/util/compat.py", > > > > line 82, in load_module_py > > > > spec.loader.exec_module(module) > > > > File "", line 728, in > > > > exec_module > > > > File "", line 219, in > > > > _call_with_frames_removed > > > > File "alembic/env.py", line 75, in > > > > run_migrations_online() > > > > File "alembic/env.py", line 70, in run_migrations_online > > > > context.run_migrations() > > > > File "", line 8, in run_migrations > > > > File > > > > "---/venv/lib/python3.7/site-packages/alembic/runtime/environment.py", > > > > line 836, in run_migrations > > > > self.get_context().run_migrations(**kw) > > > > File > > > > "---/venv/lib/python3.7/site-packages/alembic/runtime/migration.py", > > > > line 321, in run_migrations > > > > for step in self._migrations_fn(heads, self): > > > > File "---/venv/lib/python3.7/site-packages/alembic/command.py", line > > > > 156, in retrieve_migrations > > > > revision_context.run_autogenerate(rev, context) > > > > File > > > > "---/venv/lib/python3.7/site-packages/alembic/autogenerate/api.py", > > > > line 415, in run_autogenerate > > > > self._run_environment(rev, migration_context, True) > > > > File > > > > "---/venv/lib/python3.7/site-packages/alembic/autogenerate/api.py", > > > > line 451, in _run_environment > > > > autogen_context, migration_script) > > > > File > > > > "---/venv/lib/python3.7/site-packages/alembic/autogenerate/compare.py", > > > > line 22, in _populate_migration_script > > > > _produce_net_changes(autogen_context, upgrade_ops) > > > > File > > > > "---/venv/lib/python3.7/site-packages/alembic/autogenerate/compare.py", > > > > line 48, in _produce_net_changes > > > > autogen_context, upgrade_ops, schemas > > > > File > > > >
Re: [sqlalchemy] Problem with Alembic autogenerate after updating to 1.0.2
easier, if you can give me a "SHOW CREATE TABLE" for a table here that has foreign key constraints and refers to a column named "id", "ID", "iD", something with those two letters in it. On Thu, Nov 8, 2018 at 9:58 AM Mike Bayer wrote: > > On Thu, Nov 8, 2018 at 9:56 AM Mike Bayer wrote: > > > > On Thu, Nov 8, 2018 at 3:36 AM wrote: > > > > > > Hi > > > > > > I had a problem with alembic autogenerate after updating to version > > > 1.0.2. I'm running MySQL 8.0.11 and Python 3.7.1 > > > No matter how my base is defined, I always get the same error. I went > > > through the error and found out it comes from function " > > > > Did you also update SQLAlchemy version? The check you see has to do > > with SQLAlchemy version 1.2.13. Can you confirm that using SQLAlchemy > > 1.2.12 resolves the issue? I can work towards making this check more > > defensive. Additionally let me run the tests on MySQL 8 to see if > > I'm missing something. > > no failures here, can you please provide a sample database model that > produces this error? > > > > > > > > > > > _correct_for_mysql_bug_88718(self, fkeys, connection)" in module > > > "base.py" with this explaination: > > > > > > # Foreign key is always in lower case (MySQL 8.0) > > > # https://bugs.mysql.com/bug.php?id=88718 > > > # issue #4344 for SQLAlchemy > > > > > > > > > This is log of error: > > > > > > INFO [alembic.runtime.migration] Context impl MySQLImpl. > > > INFO [alembic.runtime.migration] Will assume non-transactional DDL. > > > Traceback (most recent call last): > > > File "---/venv/bin/alembic", line 11, in > > > load_entry_point('alembic==1.0.2', 'console_scripts', 'alembic')() > > > File "---/venv/lib/python3.7/site-packages/alembic/config.py", line > > > 502, in main > > > CommandLine(prog=prog).main(argv=argv) > > > File "---/venv/lib/python3.7/site-packages/alembic/config.py", line > > > 496, in main > > > self.run_cmd(cfg, options) > > > File "---/venv/lib/python3.7/site-packages/alembic/config.py", line > > > 479, in run_cmd > > > **dict((k, getattr(options, k, None)) for k in kwarg) > > > File "---/venv/lib/python3.7/site-packages/alembic/command.py", line > > > 176, in revision > > > script_directory.run_env() > > > File "---/venv/lib/python3.7/site-packages/alembic/script/base.py", > > > line 427, in run_env > > > util.load_python_file(self.dir, 'env.py') > > > File "---/venv/lib/python3.7/site-packages/alembic/util/pyfiles.py", > > > line 81, in load_python_file > > > module = load_module_py(module_id, path) > > > File "---/venv/lib/python3.7/site-packages/alembic/util/compat.py", > > > line 82, in load_module_py > > > spec.loader.exec_module(module) > > > File "", line 728, in exec_module > > > File "", line 219, in > > > _call_with_frames_removed > > > File "alembic/env.py", line 75, in > > > run_migrations_online() > > > File "alembic/env.py", line 70, in run_migrations_online > > > context.run_migrations() > > > File "", line 8, in run_migrations > > > File > > > "---/venv/lib/python3.7/site-packages/alembic/runtime/environment.py", > > > line 836, in run_migrations > > > self.get_context().run_migrations(**kw) > > > File > > > "---/venv/lib/python3.7/site-packages/alembic/runtime/migration.py", line > > > 321, in run_migrations > > > for step in self._migrations_fn(heads, self): > > > File "---/venv/lib/python3.7/site-packages/alembic/command.py", line > > > 156, in retrieve_migrations > > > revision_context.run_autogenerate(rev, context) > > > File > > > "---/venv/lib/python3.7/site-packages/alembic/autogenerate/api.py", line > > > 415, in run_autogenerate > > > self._run_environment(rev, migration_context, True) > > > File > > > "---/venv/lib/python3.7/site-packages/alembic/autogenerate/api.py", line > > > 451, in _run_environment > > > autogen_context, migration_script) > > > File > > > "---/venv/lib/python3.7/site-packages/alembic/autogenerate/compare.py", > > > line 22, in _populate_migration_script > > > _produce_net_changes(autogen_context, upgrade_ops) > > > File > > > "---/venv/lib/python3.7/site-packages/alembic/autogenerate/compare.py", > > > line 48, in _produce_net_changes > > > autogen_context, upgrade_ops, schemas > > > File > > > "---/venv/lib/python3.7/site-packages/alembic/util/langhelpers.py", line > > > 313, in go > > > fn(*arg, **kw) > > > File > > > "---/venv/lib/python3.7/site-packages/alembic/autogenerate/compare.py", > > > line 75, in _autogen_for_tables > > > inspector, upgrade_ops, autogen_context) > > > File > > > "---/venv/lib/python3.7/site-packages/alembic/autogenerate/compare.py", > > > line 137, in _compare_tables > > > inspector.reflecttable(t, None) > > > File > > > "---/venv/lib/python3.7/site-packages/sqlalchemy/engine/reflection.py", > > > line 633, in reflecttable > > > exclude_columns, _extend_on, reflection_options) > > >
Re: [sqlalchemy] Problem with Alembic autogenerate after updating to 1.0.2
On Thu, Nov 8, 2018 at 9:56 AM Mike Bayer wrote: > > On Thu, Nov 8, 2018 at 3:36 AM wrote: > > > > Hi > > > > I had a problem with alembic autogenerate after updating to version 1.0.2. > > I'm running MySQL 8.0.11 and Python 3.7.1 > > No matter how my base is defined, I always get the same error. I went > > through the error and found out it comes from function " > > Did you also update SQLAlchemy version? The check you see has to do > with SQLAlchemy version 1.2.13. Can you confirm that using SQLAlchemy > 1.2.12 resolves the issue? I can work towards making this check more > defensive. Additionally let me run the tests on MySQL 8 to see if > I'm missing something. no failures here, can you please provide a sample database model that produces this error? > > > > > > _correct_for_mysql_bug_88718(self, fkeys, connection)" in module "base.py" > > with this explaination: > > > > # Foreign key is always in lower case (MySQL 8.0) > > # https://bugs.mysql.com/bug.php?id=88718 > > # issue #4344 for SQLAlchemy > > > > > > This is log of error: > > > > INFO [alembic.runtime.migration] Context impl MySQLImpl. > > INFO [alembic.runtime.migration] Will assume non-transactional DDL. > > Traceback (most recent call last): > > File "---/venv/bin/alembic", line 11, in > > load_entry_point('alembic==1.0.2', 'console_scripts', 'alembic')() > > File "---/venv/lib/python3.7/site-packages/alembic/config.py", line 502, > > in main > > CommandLine(prog=prog).main(argv=argv) > > File "---/venv/lib/python3.7/site-packages/alembic/config.py", line 496, > > in main > > self.run_cmd(cfg, options) > > File "---/venv/lib/python3.7/site-packages/alembic/config.py", line 479, > > in run_cmd > > **dict((k, getattr(options, k, None)) for k in kwarg) > > File "---/venv/lib/python3.7/site-packages/alembic/command.py", line 176, > > in revision > > script_directory.run_env() > > File "---/venv/lib/python3.7/site-packages/alembic/script/base.py", line > > 427, in run_env > > util.load_python_file(self.dir, 'env.py') > > File "---/venv/lib/python3.7/site-packages/alembic/util/pyfiles.py", line > > 81, in load_python_file > > module = load_module_py(module_id, path) > > File "---/venv/lib/python3.7/site-packages/alembic/util/compat.py", line > > 82, in load_module_py > > spec.loader.exec_module(module) > > File "", line 728, in exec_module > > File "", line 219, in > > _call_with_frames_removed > > File "alembic/env.py", line 75, in > > run_migrations_online() > > File "alembic/env.py", line 70, in run_migrations_online > > context.run_migrations() > > File "", line 8, in run_migrations > > File > > "---/venv/lib/python3.7/site-packages/alembic/runtime/environment.py", line > > 836, in run_migrations > > self.get_context().run_migrations(**kw) > > File "---/venv/lib/python3.7/site-packages/alembic/runtime/migration.py", > > line 321, in run_migrations > > for step in self._migrations_fn(heads, self): > > File "---/venv/lib/python3.7/site-packages/alembic/command.py", line 156, > > in retrieve_migrations > > revision_context.run_autogenerate(rev, context) > > File "---/venv/lib/python3.7/site-packages/alembic/autogenerate/api.py", > > line 415, in run_autogenerate > > self._run_environment(rev, migration_context, True) > > File "---/venv/lib/python3.7/site-packages/alembic/autogenerate/api.py", > > line 451, in _run_environment > > autogen_context, migration_script) > > File > > "---/venv/lib/python3.7/site-packages/alembic/autogenerate/compare.py", > > line 22, in _populate_migration_script > > _produce_net_changes(autogen_context, upgrade_ops) > > File > > "---/venv/lib/python3.7/site-packages/alembic/autogenerate/compare.py", > > line 48, in _produce_net_changes > > autogen_context, upgrade_ops, schemas > > File "---/venv/lib/python3.7/site-packages/alembic/util/langhelpers.py", > > line 313, in go > > fn(*arg, **kw) > > File > > "---/venv/lib/python3.7/site-packages/alembic/autogenerate/compare.py", > > line 75, in _autogen_for_tables > > inspector, upgrade_ops, autogen_context) > > File > > "---/venv/lib/python3.7/site-packages/alembic/autogenerate/compare.py", > > line 137, in _compare_tables > > inspector.reflecttable(t, None) > > File > > "---/venv/lib/python3.7/site-packages/sqlalchemy/engine/reflection.py", > > line 633, in reflecttable > > exclude_columns, _extend_on, reflection_options) > > File > > "---/venv/lib/python3.7/site-packages/sqlalchemy/engine/reflection.py", > > line 729, in _reflect_fk > > table_name, schema, **table.dialect_kwargs) > > File > > "---/venv/lib/python3.7/site-packages/sqlalchemy/engine/reflection.py", > > line 447, in get_foreign_keys > > **kw) > > File "", line 2, in get_foreign_keys > > File > > "---/venv/lib/python3.7/site-packages/sqlalchemy/engine/reflection.py", > > line 54, in cache > > ret = fn(self,
Re: [sqlalchemy] Problem with Alembic autogenerate after updating to 1.0.2
On Thu, Nov 8, 2018 at 3:36 AM wrote: > > Hi > > I had a problem with alembic autogenerate after updating to version 1.0.2. > I'm running MySQL 8.0.11 and Python 3.7.1 > No matter how my base is defined, I always get the same error. I went through > the error and found out it comes from function " Did you also update SQLAlchemy version? The check you see has to do with SQLAlchemy version 1.2.13. Can you confirm that using SQLAlchemy 1.2.12 resolves the issue? I can work towards making this check more defensive. Additionally let me run the tests on MySQL 8 to see if I'm missing something. > > _correct_for_mysql_bug_88718(self, fkeys, connection)" in module "base.py" > with this explaination: > > # Foreign key is always in lower case (MySQL 8.0) > # https://bugs.mysql.com/bug.php?id=88718 > # issue #4344 for SQLAlchemy > > > This is log of error: > > INFO [alembic.runtime.migration] Context impl MySQLImpl. > INFO [alembic.runtime.migration] Will assume non-transactional DDL. > Traceback (most recent call last): > File "---/venv/bin/alembic", line 11, in > load_entry_point('alembic==1.0.2', 'console_scripts', 'alembic')() > File "---/venv/lib/python3.7/site-packages/alembic/config.py", line 502, in > main > CommandLine(prog=prog).main(argv=argv) > File "---/venv/lib/python3.7/site-packages/alembic/config.py", line 496, in > main > self.run_cmd(cfg, options) > File "---/venv/lib/python3.7/site-packages/alembic/config.py", line 479, in > run_cmd > **dict((k, getattr(options, k, None)) for k in kwarg) > File "---/venv/lib/python3.7/site-packages/alembic/command.py", line 176, > in revision > script_directory.run_env() > File "---/venv/lib/python3.7/site-packages/alembic/script/base.py", line > 427, in run_env > util.load_python_file(self.dir, 'env.py') > File "---/venv/lib/python3.7/site-packages/alembic/util/pyfiles.py", line > 81, in load_python_file > module = load_module_py(module_id, path) > File "---/venv/lib/python3.7/site-packages/alembic/util/compat.py", line > 82, in load_module_py > spec.loader.exec_module(module) > File "", line 728, in exec_module > File "", line 219, in _call_with_frames_removed > File "alembic/env.py", line 75, in > run_migrations_online() > File "alembic/env.py", line 70, in run_migrations_online > context.run_migrations() > File "", line 8, in run_migrations > File "---/venv/lib/python3.7/site-packages/alembic/runtime/environment.py", > line 836, in run_migrations > self.get_context().run_migrations(**kw) > File "---/venv/lib/python3.7/site-packages/alembic/runtime/migration.py", > line 321, in run_migrations > for step in self._migrations_fn(heads, self): > File "---/venv/lib/python3.7/site-packages/alembic/command.py", line 156, > in retrieve_migrations > revision_context.run_autogenerate(rev, context) > File "---/venv/lib/python3.7/site-packages/alembic/autogenerate/api.py", > line 415, in run_autogenerate > self._run_environment(rev, migration_context, True) > File "---/venv/lib/python3.7/site-packages/alembic/autogenerate/api.py", > line 451, in _run_environment > autogen_context, migration_script) > File > "---/venv/lib/python3.7/site-packages/alembic/autogenerate/compare.py", line > 22, in _populate_migration_script > _produce_net_changes(autogen_context, upgrade_ops) > File > "---/venv/lib/python3.7/site-packages/alembic/autogenerate/compare.py", line > 48, in _produce_net_changes > autogen_context, upgrade_ops, schemas > File "---/venv/lib/python3.7/site-packages/alembic/util/langhelpers.py", > line 313, in go > fn(*arg, **kw) > File > "---/venv/lib/python3.7/site-packages/alembic/autogenerate/compare.py", line > 75, in _autogen_for_tables > inspector, upgrade_ops, autogen_context) > File > "---/venv/lib/python3.7/site-packages/alembic/autogenerate/compare.py", line > 137, in _compare_tables > inspector.reflecttable(t, None) > File > "---/venv/lib/python3.7/site-packages/sqlalchemy/engine/reflection.py", line > 633, in reflecttable > exclude_columns, _extend_on, reflection_options) > File > "---/venv/lib/python3.7/site-packages/sqlalchemy/engine/reflection.py", line > 729, in _reflect_fk > table_name, schema, **table.dialect_kwargs) > File > "---/venv/lib/python3.7/site-packages/sqlalchemy/engine/reflection.py", line > 447, in get_foreign_keys > **kw) > File "", line 2, in get_foreign_keys > File > "---/venv/lib/python3.7/site-packages/sqlalchemy/engine/reflection.py", line > 54, in cache > ret = fn(self, con, *args, **kw) > File > "---/venv/lib/python3.7/site-packages/sqlalchemy/dialects/mysql/base.py", > line 2081, in get_foreign_keys > self._correct_for_mysql_bug_88718(fkeys, connection) > File > "---/venv/lib/python3.7/site-packages/sqlalchemy/dialects/mysql/base.py", > line 2126, in _correct_for_mysql_bug_88718 > for col in fkey['referred_columns'] >
[sqlalchemy] Problem with Alembic autogenerate after updating to 1.0.2
Hi I had a problem with alembic autogenerate after updating to version 1.0.2. I'm running MySQL 8.0.11 and Python 3.7.1 No matter how my base is defined, I always get the same error. I went through the error and found out it comes from function " _correct_for_mysql_bug_88718(self, fkeys, connection)" in module "base.py" with this explaination: # Foreign key is always in lower case (MySQL 8.0) # https://bugs.mysql.com/bug.php?id=88718 # issue #4344 for SQLAlchemy This is log of error: INFO [alembic.runtime.migration] Context impl MySQLImpl. INFO [alembic.runtime.migration] Will assume non-transactional DDL. Traceback (most recent call last): File "---/venv/bin/alembic", line 11, in load_entry_point('alembic==1.0.2', 'console_scripts', 'alembic')() File "---/venv/lib/python3.7/site-packages/alembic/config.py", line 502, in main CommandLine(prog=prog).main(argv=argv) File "---/venv/lib/python3.7/site-packages/alembic/config.py", line 496, in main self.run_cmd(cfg, options) File "---/venv/lib/python3.7/site-packages/alembic/config.py", line 479, in run_cmd **dict((k, getattr(options, k, None)) for k in kwarg) File "---/venv/lib/python3.7/site-packages/alembic/command.py", line 176, in revision script_directory.run_env() File "---/venv/lib/python3.7/site-packages/alembic/script/base.py", line 427, in run_env util.load_python_file(self.dir, 'env.py') File "---/venv/lib/python3.7/site-packages/alembic/util/pyfiles.py", line 81, in load_python_file module = load_module_py(module_id, path) File "---/venv/lib/python3.7/site-packages/alembic/util/compat.py", line 82, in load_module_py spec.loader.exec_module(module) File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "alembic/env.py", line 75, in run_migrations_online() File "alembic/env.py", line 70, in run_migrations_online context.run_migrations() File "", line 8, in run_migrations File "---/venv/lib/python3.7/site-packages/alembic/runtime/environment.py", line 836, in run_migrations self.get_context().run_migrations(**kw) File "---/venv/lib/python3.7/site-packages/alembic/runtime/migration.py", line 321, in run_migrations for step in self._migrations_fn(heads, self): File "---/venv/lib/python3.7/site-packages/alembic/command.py", line 156, in retrieve_migrations revision_context.run_autogenerate(rev, context) File "---/venv/lib/python3.7/site-packages/alembic/autogenerate/api.py", line 415, in run_autogenerate self._run_environment(rev, migration_context, True) File "---/venv/lib/python3.7/site-packages/alembic/autogenerate/api.py", line 451, in _run_environment autogen_context, migration_script) File "---/venv/lib/python3.7/site-packages/alembic/autogenerate/compare.py", line 22, in _populate_migration_script _produce_net_changes(autogen_context, upgrade_ops) File "---/venv/lib/python3.7/site-packages/alembic/autogenerate/compare.py", line 48, in _produce_net_changes autogen_context, upgrade_ops, schemas File "---/venv/lib/python3.7/site-packages/alembic/util/langhelpers.py", line 313, in go fn(*arg, **kw) File "---/venv/lib/python3.7/site-packages/alembic/autogenerate/compare.py", line 75, in _autogen_for_tables inspector, upgrade_ops, autogen_context) File "---/venv/lib/python3.7/site-packages/alembic/autogenerate/compare.py", line 137, in _compare_tables inspector.reflecttable(t, None) File "---/venv/lib/python3.7/site-packages/sqlalchemy/engine/reflection.py", line 633, in reflecttable exclude_columns, _extend_on, reflection_options) File "---/venv/lib/python3.7/site-packages/sqlalchemy/engine/reflection.py", line 729, in _reflect_fk table_name, schema, **table.dialect_kwargs) File "---/venv/lib/python3.7/site-packages/sqlalchemy/engine/reflection.py", line 447, in get_foreign_keys **kw) File "", line 2, in get_foreign_keys File "---/venv/lib/python3.7/site-packages/sqlalchemy/engine/reflection.py", line 54, in cache ret = fn(self, con, *args, **kw) File "---/venv/lib/python3.7/site-packages/sqlalchemy/dialects/mysql/base.py", line 2081, in get_foreign_keys self._correct_for_mysql_bug_88718(fkeys, connection) File "---/venv/lib/python3.7/site-packages/sqlalchemy/dialects/mysql/base.py", line 2126, in _correct_for_mysql_bug_88718 for col in fkey['referred_columns'] File "---/venv/lib/python3.7/site-packages/sqlalchemy/dialects/mysql/base.py", line 2126, in for col in fkey['referred_columns'] KeyError: 'id' -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from