Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fk reflection issue #70 #71

Merged
merged 1 commit into from
Dec 6, 2015
Merged

Fix fk reflection issue #70 #71

merged 1 commit into from
Dec 6, 2015

Conversation

graingert
Copy link
Member

Fix parsing of FK relationships with schemas, eg of the form ... REFERENCES schema.table (col)

@graingert graingert force-pushed the fix-fk-reflection-issue branch 2 times, most recently from 65befaf to 00e6abb Compare December 4, 2015 15:35
@graingert
Copy link
Member Author

@berdario does this only apply with tables not on the public schema?

@berdario
Copy link
Contributor

berdario commented Dec 4, 2015

Yeah, it was again on a different schema than public

@graingert graingert force-pushed the fix-fk-reflection-issue branch 4 times, most recently from 3f5f9ed to 5ee52e8 Compare December 5, 2015 16:47
@graingert
Copy link
Member Author

@berdario this looks like it fixes your issue!

@berdario
Copy link
Contributor

berdario commented Dec 5, 2015

Awesome! I'll try it right away

@graingert
Copy link
Member Author

@berdario OK, try this out by installing with
pip install https://github.com/sqlalchemy-redshift/sqlalchemy-redshift/archive/fix-fk-reflection-issue.tar.gz
then if it works I'll merge it in and release it on PyPI

@berdario
Copy link
Contributor

berdario commented Dec 5, 2015

Thanks

The error is report in #70 disappeared, but there's still another regression compared to 0.1.2

this is the traceback:

File "/home/dario/Projects/l2/Hydra/database/hydra_database/__init__.py", line 81, in cached_metadatas
  redshiftmeta.reflect(only=tablenames, schema=schema)
File "/home/dario/.local/share/virtualenvs/hydra_worker/local/lib/python2.7/site-packages/sqlalchemy/sql/schema.py", line 3647, in reflect
  Table(name, self, **reflect_opts)
File "/home/dario/.local/share/virtualenvs/hydra_worker/local/lib/python2.7/site-packages/sqlalchemy/sql/schema.py", line 416, in __new__
  metadata._remove_table(name, schema)
File "/home/dario/.local/share/virtualenvs/hydra_worker/local/lib/python2.7/site-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__
  compat.reraise(exc_type, exc_value, exc_tb)
File "/home/dario/.local/share/virtualenvs/hydra_worker/local/lib/python2.7/site-packages/sqlalchemy/sql/schema.py", line 411, in __new__
  table._init(name, metadata, *args, **kw)
File "/home/dario/.local/share/virtualenvs/hydra_worker/local/lib/python2.7/site-packages/sqlalchemy/sql/schema.py", line 484, in _init
  self._autoload(metadata, autoload_with, include_columns)
File "/home/dario/.local/share/virtualenvs/hydra_worker/local/lib/python2.7/site-packages/sqlalchemy/sql/schema.py", line 496, in _autoload
  self, include_columns, exclude_columns
File "/home/dario/.local/share/virtualenvs/hydra_worker/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1477, in run_callable
  return callable_(self, *args, **kwargs)
File "/home/dario/.local/share/virtualenvs/hydra_worker/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 364, in reflecttable
  return insp.reflecttable(table, include_columns, exclude_columns)
File "/home/dario/.local/share/virtualenvs/hydra_worker/local/lib/python2.7/site-packages/sqlalchemy/engine/reflection.py", line 578, in reflecttable
  exclude_columns, reflection_options)
File "/home/dario/.local/share/virtualenvs/hydra_worker/local/lib/python2.7/site-packages/sqlalchemy/engine/reflection.py", line 687, in _reflect_fk
  **reflection_options
File "/home/dario/.local/share/virtualenvs/hydra_worker/local/lib/python2.7/site-packages/sqlalchemy/sql/schema.py", line 416, in __new__
  metadata._remove_table(name, schema)
File "/home/dario/.local/share/virtualenvs/hydra_worker/local/lib/python2.7/site-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__
  compat.reraise(exc_type, exc_value, exc_tb)
File "/home/dario/.local/share/virtualenvs/hydra_worker/local/lib/python2.7/site-packages/sqlalchemy/sql/schema.py", line 411, in __new__
  table._init(name, metadata, *args, **kw)
File "/home/dario/.local/share/virtualenvs/hydra_worker/local/lib/python2.7/site-packages/sqlalchemy/sql/schema.py", line 484, in _init
  self._autoload(metadata, autoload_with, include_columns)
File "/home/dario/.local/share/virtualenvs/hydra_worker/local/lib/python2.7/site-packages/sqlalchemy/sql/schema.py", line 496, in _autoload
  self, include_columns, exclude_columns
File "/home/dario/.local/share/virtualenvs/hydra_worker/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1477, in run_callable
  return callable_(self, *args, **kwargs)
File "/home/dario/.local/share/virtualenvs/hydra_worker/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 364, in reflecttable
  return insp.reflecttable(table, include_columns, exclude_columns)
File "/home/dario/.local/share/virtualenvs/hydra_worker/local/lib/python2.7/site-packages/sqlalchemy/engine/reflection.py", line 547, in reflecttable
  table_name, schema, **table.dialect_kwargs)
File "/home/dario/.local/share/virtualenvs/hydra_worker/local/lib/python2.7/site-packages/sqlalchemy/engine/reflection.py", line 312, in get_table_options
  info_cache=self.info_cache, **kw)
File "<string>", line 2, in get_table_options
File "/home/dario/.local/share/virtualenvs/hydra_worker/local/lib/python2.7/site-packages/sqlalchemy/engine/reflection.py", line 54, in cache
  ret = fn(self, con, *args, **kw)
File "/home/dario/.local/share/virtualenvs/hydra_worker/local/lib/python2.7/site-packages/sqlalchemy_redshift/dialect.py", line 493, in get_table_options
  schema, **kw)
File "/home/dario/.local/share/virtualenvs/hydra_worker/local/lib/python2.7/site-packages/sqlalchemy_redshift/dialect.py", line 576, in _get_redshift_relation
  raise sa.exc.NoSuchTableError(key)
sqlalchemy.exc.NoSuchTableError: ref."domain"

I'll try to create a small test case now

graingert added a commit that referenced this pull request Dec 6, 2015
@graingert graingert merged commit a60c4a4 into master Dec 6, 2015
@graingert graingert deleted the fix-fk-reflection-issue branch December 6, 2015 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants