Skip to content

c/driver/sqlite: Use of implicit "main" schema and/or table names that require quoting broken for SQLite in 0.6.x #1000

@alexander-beedie

Description

@alexander-beedie

It seems something significant has changed between the 0.5.x and 0.6.x releases, as the standard main1 db schema can no longer be referenced in SQLite queries, and neither can table names that need to be quoted.

The following minimal test-cases demonstrate the issues:

  • Setup

    from adbc_driver_sqlite.dbapi import connect
    import pyarrow as pa
    
    data = pa.Table.from_pydict({
        "key": ["aa", "bb", "cc"], 
        "value": [10, 20, 30], 
    })
  • Use of main with a simple table name...

    with connect() as conn, conn.cursor() as crsr: 
        crsr.adbc_ingest( "main.test_data", data, "create" )
        conn.commit()

    ...now raises:

    adbc_driver_manager._lib.InternalError: ADBC_STATUS_INTERNAL (9): 
    [SQLite] Failed to prepare statement: no such table: main.test_data 
    (executed 'INSERT INTO main.test_data VALUES (?, ?)')
    
  • Use of a table name that requires quoting...

    with connect() as conn, conn.cursor() as crsr:
        crsr.adbc_ingest( '"test-data"', data, "create" )
        conn.commit()

    ...now raises:

    adbc_driver_manager._lib.InternalError: ADBC_STATUS_INTERNAL (9): 
    [SQLite] Failed to prepare statement: no such table: test-data 
    (executed 'INSERT INTO "test-data" VALUES (?, ?)')
    

In the previous release (0.5.x) these examples both work correctly, as expected 👍

Footnotes

  1. Note that main should always be valid, as it refers to the primary db being connected to (other names can be brought in via ATTACH DATABASE).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions