Skip to content

[BUG] dask-sql creates all tables as lower case. #481

Open
@brightsparc

Description

@brightsparc

The dask create_table method adds to the list of tables with lower case which means that any queries that are executed must use the lower case name.

What happened:

All tables are registered as lower case, so I am unable to include any queries with upper case table names - which requires me to convert all queries to lower().

What you expected to happen:

I would expect that the case would be preserved when adding to schemas, or at least like in the case of #177 there would be an original and lower case verison.

Minimal Complete Verifiable Example:

See the following code snippet that creates a dask dataframe, and then creates two tables, one with lower_case name, and another with UPPER_CASE.

from dask_sql import Context
c = Context()

ddf = dd.from_pandas(pd.DataFrame({"key": ["value"]}), npartitions=1)

# create table with lower case
c.create_table("lower_case", ddf)
print(c.schema["root"].tables) 
c.sql("SELECT * FROM lower_case")

# Create table with upper case
c.create_table("UPPER_CASE", ddf)
print(c.schema["root"].tables) 
c.sql("SELECT * FROM UPPER_CASE")

The second call to print the tables lists both as lower case:

{'lower_case': <dask_sql.datacontainer.DataContainer object at 0x2d8432970>, 'upper_case': <dask_sql.datacontainer.DataContainer object at 0x2d49d9670>}

And the second select fails to find the table with upper case

ParsingException: Can not parse the given SQL: From line 1, column 15 to line 1, column 24: Object 'UPPER_CASE' not found within 'root'; did you mean 'upper_case'?

Anything else we need to know?:

Perhaps there is a reason why everything was made lower() - but I can't seem to find it in the docs.

Environment:

  • dask-sql version: 2022.4.1
  • Python version: 3.9
  • Operating System: mac-osx arm64
  • Install method (conda, pip, source): conda

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds triageAwaiting triage by a dask-sql maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions