0
votes

Have this ODBC connection to retrieve data from Snowflake to my Laravel 5.8 application, and It currently working fine, the problem is when I running a simple SELECT STATEMENT all that data that is type VARCHAR(16777216) its coming NULL.

I don't have any idea why this is hapenning, but when I connect this snowflake through my Dbeaver, It works fine. I'm very confused about snowflake documentation, and already tried to cast the return to UTF-8 but It didnt work.

This is a dump from my data coming through this connection:

      ^ array:1 [▼
  0 => {#1634 ▼
    +"ID": "10958317"
    +"GLOBAL_PERSON_ID": "64880"
    +"INSTANCE_ID": "1"
    +"SOURCE_ID": null
    +"FIRST_NAME": null
    +"LAST_NAME": null
    +"AVATAR_URL": null
    +"BIRTH_DATE": null
    +"EMAIL": null
    +"POSTAL_CODE": null
    +"INSTITUTION_ROLE": null
    +"INSTITUTION_ROLE_SOURCE_CODE": null
    +"INSTITUTION_ROLE_SOURCE_DESC": null
    +"SYSTEM_ROLE": null
    +"SYSTEM_ROLE_SOURCE_CODE": null
    +"SYSTEM_ROLE_SOURCE_DESC": null
    +"AVAILABLE_IND": null
    +"ENABLED_IND": null
    +"STAGE": null
    +"ROW_INSERTED_TIME": null
    +"ROW_UPDATED_TIME": null
    +"ROW_DELETED_TIME": null
    +"CREATED_TIME": null
    +"MODIFIED_TIME": null
  }
]

This is the same QUERY but running in Snowflake app. enter image description here

This is the data type of the table: enter image description here

This is my Laravel code trying to get the same result:

    public static function testConnect()
{
    return DB::connection('snowflake')->select("
    SELECT * FROM CDM_LMS.PERSON
    WHERE FIRST_NAME = 'Calebe'
    ");
}
    Illuminate\Database\Query\Builder {#1629 ▼
  +connection: Dbt\Odbc\Connection {#1624 ▼
    -keyFormat: "database.connections.odbc.grammar.%s"
    #pdo: Doctrine\DBAL\Driver\PDOConnection {#1631 ▼
      inTransaction: false
      attributes: {▼
        CASE: NATURAL
        ERRMODE: EXCEPTION
        PERSISTENT: false
        DRIVER_NAME: "odbc"
        ORACLE_NULLS: NATURAL
        CLIENT_VERSION: "ODBC-Win32"
        STATEMENT_CLASS: array:2 [▼
          0 => "Doctrine\DBAL\Driver\PDO\Statement"
          1 => []
        ]
        DEFAULT_FETCH_MODE: BOTH
      }
    }
    #readPdo: null
    #database: "BLACKBOARD_DATA_6CB6608FBA4442E7A3F2161F82A41E70"
1
not all data id is correct, so you must have a left join without corresponding values in the other tabls - nbk
Nop, all data coming from same table. And the most weird part is that If I verify the data type of this fields, ID (Wich return smth) and GLOBAL_PERSON_ID have the same type. - calebe santana
show us the table with data and query in sql and text form to make a minimal reproducible example - nbk
I added some prints to the question - calebe santana

1 Answers

0
votes

Done using another package to create ODBC connection.

https://github.com/andreossido/laravel-odbc

Didn't figure out what was the problem with the other package but, it works like a charm now!