Skip to content

Allow setting table name in from_... functions #259

@simicd

Description

@simicd

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
The functions introduced with #241 currently do not allow to specify a table name. By default the table name is a random hash making SQL queries more difficult to use.

Describe the solution you'd like
Be able to set table name in the from_... functions.

Before:

ctx.from_pydict({"a": [1, 2, 3], "b": [4, None, 6]})     # -> Would like to set table name here...
table_name = ctx.catalog().database().names().pop()      # ❌ ... so that table name is known and doesn't have to be derived like this
result_df = ctx.sql(f"select a, is_null(b) as b_is_null from {table_name}")

After:

ctx.from_pydict({"a": [1, 2, 3], "b": [4, None, 6]}, name="t")
result_df = ctx.sql(f"select a, is_null(b) as b_is_null from t")

Additionally update the UDF/UDAF SQL example introduced in PR #258

Describe alternatives you've considered
n/a

Additional context
n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions