Hi there - is there a specific place to add that class so that it gets picked up by alembic? Added to env.py but did not get registered
Thanks On Saturday, November 1, 2014 at 10:40:05 AM UTC-4, Michael Bayer wrote: > > alembic doesn’t have a formally published extension API as of yet, to get > that to work you’d need to make an Impl: > > > from alembic.ddl.postgresql import PostgresqlImpl > > class RedshiftImpl(PostgresqlImpl): > __dialect__ = ‘redshift’ > > > that will register the name “redshift” into alembic’s lookup. > > > > > > > On Oct 31, 2014, at 4:34 PM, Daniel Son <danie...@knewton.com > <javascript:>> wrote: > > Hi, > I'm new to SQLalchemy and alembic and I'm doing a proof of concept for > migrations in Redshift. > > Initially, using the regular postgresql dialect everything is fine. > But when I try to use the redshift_sqlalchemy dialect for the last bit of > Redshift functionality, it goes caput. > And I've looked over SQLAlchemy and Alembic docs for any help on using 3rd > Party dialects and I can't seem to get anywhere. > > Environment: > The basic setup as told by the Tutorial > > The following are installed in a virtualenv: > pip install alembic > pip install psycopg2 > pip install redshift_sqlalchemy > > I've tried to manually register the dialect: > from sqlalchemy.dialects import registry > registry.register("redshift", "redshift_sqlalchemy.dialect", > "RedshiftDialect") > registry.register("redshift.psycopg2", "redshift_sqlalchemy.dialect", > "RedshiftDialect") > > And tried the following url setups in my alembic.ini (via alembic init) > sqlalchemy.url = redshift+psycopg2://user:pass@host:port/dbname > sqlalchemy.url = redshift://user:pass@host:port/dbname > > Both error out the same as this trace out. > > Traceback (most recent call last): > File "/opt/virtualenvs/alembic/bin/alembic", line 9, in <module> > load_entry_point('alembic==0.6.7', 'console_scripts', 'alembic')() > File > "/opt/virtualenvs/alembic/lib/python2.7/site-packages/alembic/config.py", > line 306, in main > CommandLine(prog=prog).main(argv=argv) > File > "/opt/virtualenvs/alembic/lib/python2.7/site-packages/alembic/config.py", > line 300, in main > self.run_cmd(cfg, options) > File > "/opt/virtualenvs/alembic/lib/python2.7/site-packages/alembic/config.py", > line 286, in run_cmd > **dict((k, getattr(options, k)) for k in kwarg) > File > "/opt/virtualenvs/alembic/lib/python2.7/site-packages/alembic/command.py", > line 129, in upgrade > script.run_env() > File > "/opt/virtualenvs/alembic/lib/python2.7/site-packages/alembic/script.py", > line 208, in run_env > util.load_python_file(self.dir, 'env.py') > File > "/opt/virtualenvs/alembic/lib/python2.7/site-packages/alembic/util.py", > line 230, in load_python_file > module = load_module_py(module_id, path) > File > "/opt/virtualenvs/alembic/lib/python2.7/site-packages/alembic/compat.py", > line 63, in load_module_py > mod = imp.load_source(module_id, path, fp) > File "dson_test/env.py", line 92, in <module> > run_migrations_online() > File "dson_test/env.py", line 80, in run_migrations_online > target_metadata=target_metadata > File "<string>", line 7, in configure > File > "/opt/virtualenvs/alembic/lib/python2.7/site-packages/alembic/environment.py", > > line 672, in configure > opts=opts > File > "/opt/virtualenvs/alembic/lib/python2.7/site-packages/alembic/migration.py", > line 158, in configure > return MigrationContext(dialect, connection, opts, environment_context) > File > "/opt/virtualenvs/alembic/lib/python2.7/site-packages/alembic/migration.py", > line 103, in __init__ > self.impl = ddl.DefaultImpl.get_by_dialect(dialect)( > File > "/opt/virtualenvs/alembic/lib/python2.7/site-packages/alembic/ddl/impl.py", > line 55, in get_by_dialect > return _impls[dialect.name] > KeyError: 'redshift' > > What am I missing? > > Thanks, > Daniel > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy-alembic" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sqlalchemy-alembic+unsubscr...@googlegroups.com <javascript:>. > For more options, visit https://groups.google.com/d/optout. > > > -- You received this message because you are subscribed to the Google Groups "sqlalchemy-alembic" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alembic+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.