Skip to content

Support Postgres JSON to arrow2  #235

@glennpierce

Description

@glennpierce

I wanted support to get JSON columns from a postgresql db as below.

I implemented this at
[email protected]:glennpierce/connector-x.git
branch postgres_json

I haven't request a PR as I only implemented for arrow2 and I not sure you would require arrow as well.
Also I store the JSON as a string in arrow2. I'm am not familiar with aroow enough to know that this was the right approach.
What do you think ?

let sql = "SELECT
                hs.haystack_tags->'carnego_ref' as site_ref,
                hsg.haystack_tags->'carnego_ref' as site_group_ref,
                hsg.namespace AS site_group_namespace,
                hs.namespace AS site_namespace,
                COALESCE(hs.smart_htc_config, hsg.smart_htc_config) as smart_htc_config,
                COALESCE(hs.portfolio_config, hsg.portfolio_config) as portfolio_config,
                COALESCE(hs.performance_config, hsg.performance_config) as performance_config
                FROM haystack_site hs
                LEFT JOIN haystack_site_group hsg ON hs.haystack_tags->'carnego_site_group_ref' = hsg.haystack_tags->'carnego_ref'
                WHERE hs.haystack_tags->'carnego_namespace' IS NOT NULL AND
                    hsg.haystack_tags->'carnego_namespace' IS NOT NULL AND
                    (COALESCE(hs.smart_htc_config, hsg.smart_htc_config) IS NOT NULL OR
                     COALESCE(hs.portfolio_config, hsg.portfolio_config) IS NOT NULL OR
                     COALESCE(hs.performance_config, hsg.performance_config) IS NOT NULL) ORDER BY 2,1".to_string();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions