GitHub user l1t1 closed a discussion: are there an option in SQL to not use
double quotation marks in a SQL
When I run SQL on a parquet file's column name has both Upper and Lower
letter, I had to use double quotation marks for them.
```python
from datafusion import SessionContext
ctx = SessionContext()
ctx.register_parquet('a', 'a.parquet')
df = ctx.sql('select * from a')
df
DataFrame()
+------+-----+
| User | Age |
+------+-----+
| Tom | 12 |
| Jack | 30 |
+------+-----+
df = ctx.sql('select "Age" from a')
df
DataFrame()
+-----+
| Age |
+-----+
| 12 |
| 30 |
+-----+
````
if I don't use double quotation marks, it reports following error.
```python
>>> df = ctx.sql('select Age from a')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
Exception: DataFusion error: SchemaError(FieldNotFound { field: Column {
relation: None, name: "age" }, valid_fields: [Column { relation: Some(Bare {
table: "a" }), name: "User" }, Column { relation: Some(Bare { table: "a" }),
name: "Age" }
] }, Some(""))
```
sometimes, it's diffcult to write a sql when there are many those fieldnames.
GitHub link: https://github.com/apache/datafusion/discussions/9399
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]