Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set case sensitive default database in connect(...) #2128

Closed
suhas-dc opened this issue Dec 30, 2024 · 1 comment
Closed

Cannot set case sensitive default database in connect(...) #2128

suhas-dc opened this issue Dec 30, 2024 · 1 comment
Assignees
Labels
question status-triage_done Initial triage done, will be further handled by the driver team

Comments

@suhas-dc
Copy link

Python version

3.11.6

Operating system and processor architecture

macOS-14.7.2-arm64-arm-64bit

Installed packages

asn1crypto                 1.5.1
certifi                    2024.12.14
cffi                       1.17.1
charset-normalizer         3.4.1
cryptography               44.0.0
filelock                   3.16.1
idna                       3.10
packaging                  24.2
pip                        23.2.1
platformdirs               4.3.6
pycparser                  2.22
PyJWT                      2.10.1
pyOpenSSL                  24.3.0
pytz                       2024.2
requests                   2.32.3
setuptools                 65.5.0
snowflake-connector-python 3.12.4
sortedcontainers           2.4.0
tomlkit                    0.13.2
typing_extensions          4.12.2
urllib3                    2.3.0

What did you do?

import snowflake.connector

conn = snowflake.connector.connect(
    user='user',
    password='password',
    account='account',
    warehouse='warehouse',
    database='CaseSensitive'
)

conn.cursor().execute('select * from SCHEMA_TEST.TESTTABLE').fetchall()

What did you expect to see?

fetchall() returns the rows of the table.

Can you set logging to DEBUG and collect the logs?

import logging
import os

for logger_name in ('snowflake.connector',):
    logger = logging.getLogger(logger_name)
    logger.setLevel(logging.DEBUG)
    ch = logging.StreamHandler()
    ch.setLevel(logging.DEBUG)
    ch.setFormatter(logging.Formatter('%(asctime)s - %(threadName)s %(filename)s:%(lineno)d - %(funcName)s() - %(levelname)s - %(message)s'))
    logger.addHandler(ch)
@sfc-gh-sghosh
Copy link

Hello @suhas-dc ,

Thanks for raising the concern.
You need to pass the case-sensitive values in quotes (enclose in quotes) as below
`
Example:
connection_params = {
"account": "account",
"user": "user",
"password": "password",
"database": '"SampleDatabaseCaseSensitive"',
"schema": "TEST",
"warehouse": "WAREHOUSE"
}

session = Session.builder.configs(connection_params).create()

result = session.sql("SELECT CURRENT_DATABASE()").collect()
print(result[0][0])

output:
SampleDatabaseCaseSensitive`

Regards,
Sujan

@sfc-gh-sghosh sfc-gh-sghosh added status-triage_done Initial triage done, will be further handled by the driver team question and removed bug needs triage labels Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question status-triage_done Initial triage done, will be further handled by the driver team
Projects
None yet
Development

No branches or pull requests

2 participants