question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[ENH] Support user control over case sensitivity

See original GitHub issue

Some SQL query generators make it difficult to control the upper/lower cases of columns, tables, etc in emitted SQL.

In my use case, I’m trying to avoid modifying a query that uses uppercase column names, where my table was defined w/ lower case column names. It’d be useful to allow a configuration of case sensitivity used in the SQL parsing step. It looks like this is doable in Calcite.

Test:

from dask_sql import Context
import pandas as pd

c = Context()
df = pd.DataFrame({'id': [0, 1]})

c.create_table('test', df)
c.sql("select ID from test")

Trace:

---------------------------------------------------------------------------
ParsingException                          Traceback (most recent call last)
/tmp/ipykernel_574321/308482520.py in <module>
      4 df = cudf.DataFrame({'id': [0, 1]})
      5 c.create_table('test', df)
----> 6 c.sql("select ID from test")

~/conda/envs/dsql-dask-main/lib/python3.8/site-packages/dask_sql/context.py in sql(self, sql, return_futures, dataframes)
    434                 self.create_table(df_name, df)
    435 
--> 436         rel, select_names, _ = self._get_ral(sql)
    437 
    438         dc = RelConverter.convert(rel, context=self)

~/conda/envs/dsql-dask-main/lib/python3.8/site-packages/dask_sql/context.py in _get_ral(self, sql)
    772             # if debug is not set.
    773             # Instead, we raise a nice exception
--> 774             raise ParsingException(sql, str(e.message())) from None
    775 
    776         # Internal, temporary results of calcite are sometimes

ParsingException: Can not parse the given SQL: org.apache.calcite.runtime.CalciteContextException: From line 1, column 8 to line 1, column 9: Column 'ID' not found in any table; did you mean 'id'?

The problem is probably somewhere here:

	select ID from test
	       ^^

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
charlesblucacommented, Feb 4, 2022

Yeah can verify that the following works for me with the latest dask-sql:

from dask_sql import Context
import pandas as pd

c = Context()
c.set_config(("dask.sql.identifier.case.sensitive", False))
df = pd.DataFrame({'id': [0, 1]})

c.create_table('test', df)
c.sql("select ID from test")
0reactions
jdye64commented, Jan 14, 2022

@randerzander are you sure you are using the correct version in your tests? This seems to works and is tested in https://github.com/dask-contrib/dask-sql/blob/main/tests/integration/test_compatibility.py#L940

Read more comments on GitHub >

github_iconTop Results From Across the Web

[KEYCLOAK-2858] Case sensitive user names - Red Hat
I'm talking about this: username = *UNICODECHARNOCRLF. Which of course does not imply case sensitivity is a must, only the charset, but they...
Read more >
InMemory: Enable case sensitivity/insensitivity setting #6153
Case sensitivity in SQL Server is actually controlled by the collation settings in the database. We can see the value in having similar...
Read more >
Case-sensitivity and the IN function - Alteryx Community
I confirmed with Client Service that the function is not case-sensitive. Obviously there are ways around this...using a join, using findstring, ...
Read more >
Case sensitivity issue between LDAP plugin and role-strategy ...
The plugin seems to make some inconsistent checks when it's an API call (bug) vs. when the user is logged in Jenkins interface...
Read more >
User Control and Freedom (Usability Heuristic #3)
The ability to easily get out of trouble encourages exploration, which facilitates learning and discovery of features. It also increases overall ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found