Skip to content

Request: a 'schema' param for the "read_sql" method (to help lower latency, and avoid some errors) #182

@alexander-beedie

Description

@alexander-beedie

This would be hugely useful - in our case we always know the result schema before issuing a query. If we can pass that schema into the read_sql function, then connector-x will not have to issue a query to the database to determine it. This will give us better latency performance (less queries required for setup) and potentially allow more complex queries to be executed (if the caller knows the schema).

I tried some fairly typical join queries on postgres (to load into a polars.DataFrame), but they fail to run; it looks like the query adjustments done by connector-x at the schema-determination stage result in a SQL syntax error. If we can pass the schema directly, this problem will be avoided, and the given SQL can be run unmodified (*if no partitioning). Thanks! :)

Example:
cx.read_sql( postgres_url, query, schema=... )

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