question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG: Fix issue with the sqlalchemy 1.3.7

See original GitHub issue

Tests are failing due the sqlachemy 1.3.7.

A workaround for that is pinning sqlalchemy to 1.3.6


con = <ibis.sql.sqlite.client.SQLiteClient object at 0x7f1e29310358>

    def test_table(con):
>       table = con.table('functional_alltypes')

ibis/sql/sqlite/tests/test_client.py:32: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
ibis/sql/sqlite/client.py:392: in table
    alch_table = self._get_sqla_table(name, schema=database)
ibis/sql/alchemy.py:1153: in _get_sqla_table
    return sa.Table(name, self.meta, schema=schema, autoload=True)
<string>:2: in __new__
    ???
/mnt/sda1/storage/miniconda/envs/ibis/lib/python3.7/site-packages/sqlalchemy/util/deprecations.py:128: in warned
    return fn(*args, **kwargs)
/mnt/sda1/storage/miniconda/envs/ibis/lib/python3.7/site-packages/sqlalchemy/sql/schema.py:496: in __new__
    metadata._remove_table(name, schema)
/mnt/sda1/storage/miniconda/envs/ibis/lib/python3.7/site-packages/sqlalchemy/util/langhelpers.py:68: in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
/mnt/sda1/storage/miniconda/envs/ibis/lib/python3.7/site-packages/sqlalchemy/util/compat.py:153: in reraise
    raise value
/mnt/sda1/storage/miniconda/envs/ibis/lib/python3.7/site-packages/sqlalchemy/sql/schema.py:491: in __new__
    table._init(name, metadata, *args, **kw)
/mnt/sda1/storage/miniconda/envs/ibis/lib/python3.7/site-packages/sqlalchemy/sql/schema.py:585: in _init
    resolve_fks=resolve_fks,
/mnt/sda1/storage/miniconda/envs/ibis/lib/python3.7/site-packages/sqlalchemy/sql/schema.py:626: in _autoload
    _extend_on=_extend_on,
/mnt/sda1/storage/miniconda/envs/ibis/lib/python3.7/site-packages/sqlalchemy/engine/base.py:2150: in run_callable
    return conn.run_callable(callable_, *args, **kwargs)
/mnt/sda1/storage/miniconda/envs/ibis/lib/python3.7/site-packages/sqlalchemy/engine/base.py:1604: in run_callable
    return callable_(self, *args, **kwargs)
/mnt/sda1/storage/miniconda/envs/ibis/lib/python3.7/site-packages/sqlalchemy/engine/default.py:431: in reflecttable
    table, include_columns, exclude_columns, resolve_fks, **opts
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.engine.reflection.Inspector object at 0x7f1e293c7be0>, table = Table('functional_alltypes', MetaData(bind=Engine(sqlite://)), schema=None), include_columns = None, exclude_columns = ()
resolve_fks = True, _extend_on = None

    def reflecttable(
        self,
        table,
        include_columns,
        exclude_columns=(),
        resolve_fks=True,
        _extend_on=None,
    ):
        """Given a Table object, load its internal constructs based on
        introspection.
    
        This is the underlying method used by most dialects to produce
        table reflection.  Direct usage is like::
    
            from sqlalchemy import create_engine, MetaData, Table
            from sqlalchemy.engine.reflection import Inspector
    
            engine = create_engine('...')
            meta = MetaData()
            user_table = Table('user', meta)
            insp = Inspector.from_engine(engine)
            insp.reflecttable(user_table, None)
    
        :param table: a :class:`~sqlalchemy.schema.Table` instance.
        :param include_columns: a list of string column names to include
          in the reflection process.  If ``None``, all columns are reflected.
    
        """
    
        if _extend_on is not None:
            if table in _extend_on:
                return
            else:
                _extend_on.add(table)
    
        dialect = self.bind.dialect
    
        schema = self.bind.schema_for_object(table)
    
        table_name = table.name
    
        # get table-level arguments that are specifically
        # intended for reflection, e.g. oracle_resolve_synonyms.
        # these are unconditionally passed to related Table
        # objects
        reflection_options = dict(
            (k, table.dialect_kwargs.get(k))
            for k in dialect.reflection_options
            if k in table.dialect_kwargs
        )
    
        # reflect table options, like mysql_engine
        tbl_opts = self.get_table_options(
            table_name, schema, **table.dialect_kwargs
        )
        if tbl_opts:
            # add additional kwargs to the Table if the dialect
            # returned them
            table._validate_dialect_kwargs(tbl_opts)
    
        if util.py2k:
            if isinstance(schema, str):
                schema = schema.decode(dialect.encoding)
            if isinstance(table_name, str):
                table_name = table_name.decode(dialect.encoding)
    
        found_table = False
        cols_by_orig_name = {}
    
        for col_d in self.get_columns(
            table_name, schema, **table.dialect_kwargs
        ):
            found_table = True
    
            self._reflect_column(
                table,
                col_d,
                include_columns,
                exclude_columns,
                cols_by_orig_name,
            )
    
        if not found_table:
>           raise exc.NoSuchTableError(table.name)
E           sqlalchemy.exc.NoSuchTableError: functional_alltypes

/mnt/sda1/storage/miniconda/envs/ibis/lib/python3.7/site-packages/sqlalchemy/engine/reflection.py:653: NoSuchTableError

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
cpcloudcommented, Aug 22, 2019

@zzzeek Thanks for the explanation, very much appreciated. I believe my PR in #1937 addresses the issue in the way you’ve described here.

1reaction
xmnlabcommented, Aug 19, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

1.3 Changelog — SQLAlchemy 2.0 Documentation
Fixed issue where the MutableComposite construct could be placed into an invalid state when the parent object was already loaded, and then covered...
Read more >
Error Messages - SQLAlchemy 1.4 Documentation
Exception raised for errors that are due to problems with the processed data like division by zero, numeric value out of range, etc....
Read more >
1.4 Changelog — SQLAlchemy 2.0 Documentation
Fixed issues that prevented the new usage patterns for using DML with ORM objects presented at Using INSERT, UPDATE and ON CONFLICT (i.e....
Read more >
Download - SQLAlchemy
Bug fixes - the primary purpose of a point release is to release fixes for bugs with no backwards incompatible changes being made....
Read more >
What's New in SQLAlchemy 1.3?
If problems are encountered, users should report a bug, however the change ... The fix is to allow the Address.user == u1 expression...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found