Skip to content

Inconsistent and sometimes incomplete list of columns #320

@bigluck

Description

@bigluck

Ciao,
I’m playing with the library to get the list of all fields accessed by a given query, but I’m getting inconsistent results based on the complexity of the SQL query.

Let’s start with a simple example like this one:



SELECT p.ID AS test, p.*
FROM MYSCHEMA.MYTABLE.PERSON AS p
WHERE 1

Result: ['MYSCHEMA.MYTABLE.PERSON.ID', 'MYSCHEMA.MYTABLE.PERSON.*']

Everything works as expected, but if I run a more straightforward SQL query like:

SELECT *
FROM MYSCHEMA.MYTABLE.PERSON
WHERE 1

I get a completely different response: ['*']; I was expecting [‘MYSCHEMA.MYTABLE.PERSON.*’] instead.

By testing a more complex query like this one, I get a completely unusable result:

SELECT
    CASE
        WHEN (
            SELECT min("ID")
            FROM MYSCHEMA.MYTABLE1
        ) > (
            SELECT max(ID)
            FROM MYSCHEMA.MYTABLE2
        ) THEN TRUE
        WHEN (
            SELECT max(ID)
            FROM MYSCHEMA.MYTABLE1
        ) < (
            SELECT min(ID)
            from MYSCHEMA.MYTABLE2
        ) THEN TRUE
        ELSE FALSE
    END AS NO_COMMON_DATA

The result is now a generic [‘ID’] event if it should be: [‘MYSCHEMA.MYTABLE1.ID’, ‘MYSCHEMA.MYTABLE2.ID’]

Finally, if I test this last query:

SELECT COUNT(*) FROM HUBSPOT.DEAL_PIPELINE

I get an empty array [] instead of [‘HUBSPOT.DEAL_PIPELINE.*’]

Who can help me? Thanks again

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions