Skip to content

[ENH] Support VALUES query #1013

Open
@jonmmease

Description

@jonmmease

Is your feature request related to a problem? Please describe.
Mostly for testing purposes, it would be great if dask-sql would support creating tables of inline data using the VALUES keyword.

Describe the solution you'd like
In many SQL dialects (including DataFusion, Postgres, and DuckDB), it's possible to construct tables from literal values using the VALUES keyword. See https://www.postgresql.org/docs/current/queries-values.html.

For example:

SELECT * FROM (VALUES (1, 2), (1, 3)) as tbl(column1, column2)

In the DataFusion CLI, this evaluates to

+---------+---------+
| column1 | column2 |
+---------+---------+
| 1       | 2       |
| 1       | 3       |
+---------+---------+

This isn't currently supported in dask-sql. For example:

from dask_sql import Context
c = Context()
result = c.sql(r"""
SELECT * FROM (VALUES (1, 2), (1, 3)) as tbl(column1, column2)
""")
...
NotImplementedError: No relational conversion for node type Values available (yet).

Describe alternatives you've considered
None

Additional context
I'm in the early stages of adding SQL support to VegaFusion, and I'd like to test SQL dialect generation using self-contained queries that include small inline datasets.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpythonAffects Python API

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions