Skip to content

[BUG] duckdb geom_col_name not actually sanity checked #768

Closed
@danielsparing

Description

@danielsparing

Context

I am calling viz on a duckdb query where I did not explicitly add a column name, so the implicit column name contains unexpected characters such as "(" (which are actually valid in a duckdb table column name, but not desired in the context of lonboard given the intent of this line)

viz(duckdb.sql("""select ST_GeomFromText('POINT (1 2)')"""))

Now tihs will fail, but we should get a meaningful error (or visualize it correctly anyway -- probably less good of an idea).

Resulting behaviour, error message or logs

Describe what happened:

!pip install lonboard --quiet

import duckdb

from lonboard import viz

duckdb.sql("""INSTALL spatial; LOAD spatial;""")

print(duckdb.sql("""select ST_GeomFromText('POINT (1 2)')"""))
# Returns:
# ┌────────────────────────────────┐
# │ st_geomfromtext('POINT (1 2)') │
# │            geometry            │
# ├────────────────────────────────┤
# │ POINT (1 2)                    │
# └────────────────────────────────┘



viz(duckdb.sql("""select ST_GeomFromText('POINT (1 2)')"""))
# throws duckdb.ParserException: Parser Error: syntax error at or near "("

viz(duckdb.sql("""select ST_GeomFromText('POINT (1 2)') as geom"""))
# opens widget

Environment

  • OS/Browser: Google Colab
  • Lonboard Version: 0.10.4

Steps to reproduce the bug

see above

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions