snowflakedb / pdo_snowflake

PHP PDO driver for snowflake
Apache License 2.0
63 stars 30 forks source link

PHP: Laravel : not generating case sensitive query #320

Closed vinodnarayankar closed 8 months ago

vinodnarayankar commented 1 year ago

Please answer these questions before submitting your issue. In order to accurately debug the issue this information is required. Thanks!

  1. What version of PDO/PHP driver are you using? php 8.0.8

  2. What operating system and processor architecture are you using? WINDOWS 11

  3. What version of C/C++ compiler are you using?

  4. What did you do?

I am trying to connect snowflake with PHP and Laravel. Connection is successful. I am able to access the database. In few cases, Laravel is generating query in upper case. Would help me providing possible solution through which my queries generate in lower case. One of the generated query through laravel is as below. in my DB I have ROLES.ID is lower case.

SQLSTATE[42000]: Syntax error or access violation: 904 SQL compilation error: error line 1 at position 190 invalid identifier 'ROLES.ID' (SQL: select ROLES.*, MODEL_HAS_ROLES.MODEL_ID AS PIVOT_MODEL_ID, MODEL_HAS_ROLES.ROLE_ID AS PIVOT_ROLE_ID, MODEL_HAS_ROLES.MODEL_TYPE AS PIVOT_MODEL_TYPE from ROLES inner join MODEL_HAS_ROLES on ROLES.ID = MODEL_HAS_ROLES.ROLE_ID where MODEL_HAS_ROLES.MODEL_ID in (9) and MODEL_HAS_ROLES.MODEL_TYPE = App\Repository\User)

  1. What did you expect to see?

    What should have happened and what happened instead?

  2. Can you set logging to DEBUG and collect the logs?

    https://community.snowflake.com/s/article/How-to-generate-log-file-on-Snowflake-connectors

  3. What is your Snowflake account identifier, if any? (Optional) Snowflake account identifier: xjrpozr-bkb40621

sfc-gh-dszmolka commented 8 months ago

hi and apologies for leaving this issue unattended for so long; we're changing that.

Snowflake stores the object identifier in uppercase by default. If you created an identifier with "myobject" then it will be indeed literally stored like that, in this case: lowercase myobject instead of the default MYOBJECT

Not sure about the options available in Laravel, maybe you can try

hope this help. marking this one as closed for now, as it doesn't seem to be an issue with the pdo_snowflake driver