Skip to content

return_type #63

@ivirshup

Description

@ivirshup

Description of feature

It would be nice to have a return_type argument that allowed results other than a pandas dataframe. Currently, I think that pyarrow.Table, ibis.Table, and pd.DataFrame (defaulting to pd.DataFrame would be a good set of options.

This would look like:

ensdb.genes(return_type=ibis.expr.types.Table)

(I generally like the idea of passing a type instead of a string literal here, but I see how the ibis case is unwieldy)

Advantages

Allows us to work with a few use cases:

  • pd.DataFrame: useful for people who don't even need to know they are using SQL. Very much the default dataframe type
  • ibis Table: lazy representation for those who explicitly want to work with the SQL
  • arrow In between, or if you want to pass it to some other library! I believe this also has potential to be lazy via chunks.

Disadvantages

Mainly complexity. Also keeping data types consistent.

It would probably be pretty easy to start with only supporting pandas and ibis, where the ibis case is just not running .execute()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions