<p dir="auto"><strong>Migrated issue, originally created by cwebber (<a href="https://github.com/cwebber">@cwebber</a>)</strong></p>
<p dir="auto">Python built with sqlite 3.8.11.1 and before seems to be working fine.  Building with newer versions of sqlite, such as 3.10.0 or 3.10.2 results in failing tests:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="=================================== FAILURES ===================================
__________ QueryTest_sqlite_pysqlite.test_column_accessor_sqlite_raw ___________
Traceback (most recent call last):
  File &quot;&lt;string&gt;&quot;, line 2, in test_column_accessor_sqlite_raw
  File &quot;/tmp/guix-build-python-sqlalchemy-0.9.7.drv-0/SQLAlchemy-0.9.7/test/../lib/sqlalchemy/testing/exclusions.py&quot;, line 72, in decorate
    return fn(*args, **kw)
  File &quot;/tmp/guix-build-python-sqlalchemy-0.9.7.drv-0/SQLAlchemy-0.9.7/test/sql/test_query.py&quot;, line 898, in test_column_accessor_sqlite_raw
    assert 'user_id' not in r
AssertionError: assert 'user_id' not in (1, 'john')
_______ QueryTest_sqlite_pysqlite.test_column_accessor_sqlite_translated _______
Traceback (most recent call last):
  File &quot;/tmp/guix-build-python-sqlalchemy-0.9.7.drv-0/SQLAlchemy-0.9.7/test/../lib/sqlalchemy/engine/result.py&quot;, line 70, in __getitem__
    processor, obj, index = self._keymap[key]
KeyError: 'query_users.user_id'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File &quot;&lt;string&gt;&quot;, line 2, in test_column_accessor_sqlite_translated
  File &quot;/tmp/guix-build-python-sqlalchemy-0.9.7.drv-0/SQLAlchemy-0.9.7/test/../lib/sqlalchemy/testing/exclusions.py&quot;, line 72, in decorate
    return fn(*args, **kw)
  File &quot;/tmp/guix-build-python-sqlalchemy-0.9.7.drv-0/SQLAlchemy-0.9.7/test/sql/test_query.py&quot;, line 918, in test_column_accessor_sqlite_translated
    eq_(r['query_users.user_id'], 1)
  File &quot;/tmp/guix-build-python-sqlalchemy-0.9.7.drv-0/SQLAlchemy-0.9.7/test/../lib/sqlalchemy/engine/result.py&quot;, line 72, in __getitem__
    processor, obj, index = self._parent._key_fallback(key)
  File &quot;/tmp/guix-build-python-sqlalchemy-0.9.7.drv-0/SQLAlchemy-0.9.7/test/../lib/sqlalchemy/engine/result.py&quot;, line 331, in _key_fallback
    expression._string_or_unprintable(key))
sqlalchemy.exc.NoSuchColumnError: &quot;Could not locate column in row for column 'query_users.user_id'&quot;
=========================== short test summary info ============================
FAIL test/sql/test_query.py::QueryTest_sqlite_pysqlite::()::test_column_accessor_sqlite_raw
FAIL test/sql/test_query.py::QueryTest_sqlite_pysqlite::()::test_column_accessor_sqlite_translated
============= 2 failed, 5803 passed, 737 skipped in 237.59 seconds =============
phase `check' failed after 241.9 seconds"><pre class="notranslate"><code class="notranslate">=================================== FAILURES ===================================
__________ QueryTest_sqlite_pysqlite.test_column_accessor_sqlite_raw ___________
Traceback (most recent call last):
  File "&lt;string&gt;", line 2, in test_column_accessor_sqlite_raw
  File "/tmp/guix-build-python-sqlalchemy-0.9.7.drv-0/SQLAlchemy-0.9.7/test/../lib/sqlalchemy/testing/exclusions.py", line 72, in decorate
    return fn(*args, **kw)
  File "/tmp/guix-build-python-sqlalchemy-0.9.7.drv-0/SQLAlchemy-0.9.7/test/sql/test_query.py", line 898, in test_column_accessor_sqlite_raw
    assert 'user_id' not in r
AssertionError: assert 'user_id' not in (1, 'john')
_______ QueryTest_sqlite_pysqlite.test_column_accessor_sqlite_translated _______
Traceback (most recent call last):
  File "/tmp/guix-build-python-sqlalchemy-0.9.7.drv-0/SQLAlchemy-0.9.7/test/../lib/sqlalchemy/engine/result.py", line 70, in __getitem__
    processor, obj, index = self._keymap[key]
KeyError: 'query_users.user_id'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "&lt;string&gt;", line 2, in test_column_accessor_sqlite_translated
  File "/tmp/guix-build-python-sqlalchemy-0.9.7.drv-0/SQLAlchemy-0.9.7/test/../lib/sqlalchemy/testing/exclusions.py", line 72, in decorate
    return fn(*args, **kw)
  File "/tmp/guix-build-python-sqlalchemy-0.9.7.drv-0/SQLAlchemy-0.9.7/test/sql/test_query.py", line 918, in test_column_accessor_sqlite_translated
    eq_(r['query_users.user_id'], 1)
  File "/tmp/guix-build-python-sqlalchemy-0.9.7.drv-0/SQLAlchemy-0.9.7/test/../lib/sqlalchemy/engine/result.py", line 72, in __getitem__
    processor, obj, index = self._parent._key_fallback(key)
  File "/tmp/guix-build-python-sqlalchemy-0.9.7.drv-0/SQLAlchemy-0.9.7/test/../lib/sqlalchemy/engine/result.py", line 331, in _key_fallback
    expression._string_or_unprintable(key))
sqlalchemy.exc.NoSuchColumnError: "Could not locate column in row for column 'query_users.user_id'"
=========================== short test summary info ============================
FAIL test/sql/test_query.py::QueryTest_sqlite_pysqlite::()::test_column_accessor_sqlite_raw
FAIL test/sql/test_query.py::QueryTest_sqlite_pysqlite::()::test_column_accessor_sqlite_translated
============= 2 failed, 5803 passed, 737 skipped in 237.59 seconds =============
phase `check' failed after 241.9 seconds
</code></pre></div>
<p dir="auto"><strong>Migrated issue, originally created by Michael Bayer (<a href="https://github.com/zzzeek">@zzzeek</a>)</strong></p>
<p dir="auto">this script in <a href="http://docs.sqlalchemy.org/en/latest/dialects/sqlite.html#dotted-column-names" rel="nofollow">http://docs.sqlalchemy.org/en/latest/dialects/sqlite.html#dotted-column-names</a> now passes:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import sqlite3

conn = sqlite3.connect(&quot;:memory:&quot;)
cursor = conn.cursor()

cursor.execute(&quot;create table x (a integer, b integer)&quot;)
cursor.execute(&quot;insert into x (a, b) values (1, 1)&quot;)
cursor.execute(&quot;insert into x (a, b) values (2, 2)&quot;)

cursor.execute(&quot;select x.a, x.b from x&quot;)
assert [c[0] for c in cursor.description] == ['a', 'b']

cursor.execute('''
    select x.a, x.b from x where a=1
    union
    select x.a, x.b from x where a=2
''')
assert [c[0] for c in cursor.description] == ['a', 'b'], \
    [c[0] for c in cursor.description]

"><pre class="notranslate"><code class="notranslate">import sqlite3

conn = sqlite3.connect(":memory:")
cursor = conn.cursor()

cursor.execute("create table x (a integer, b integer)")
cursor.execute("insert into x (a, b) values (1, 1)")
cursor.execute("insert into x (a, b) values (2, 2)")

cursor.execute("select x.a, x.b from x")
assert [c[0] for c in cursor.description] == ['a', 'b']

cursor.execute('''
    select x.a, x.b from x where a=1
    union
    select x.a, x.b from x where a=2
''')
assert [c[0] for c in cursor.description] == ['a', 'b'], \
    [c[0] for c in cursor.description]


</code></pre></div>
<p dir="auto">the sqlite checkin is <a href="http://www.sqlite.org/src/info/47f10b7e5d8c1d96" rel="nofollow">http://www.sqlite.org/src/info/47f10b7e5d8c1d96</a>.  We need to turn off translate_colnames for this version and also some tests fail.</p>