Skip to content

Picking out the column names from a select statement #279

Open
@skcuslleb

Description

@skcuslleb

Hi there,

I can't quite figure out if it's possible to determine the column names returned by a select statement. I think I've narrowed it down to:
a) If there's an alias I use
parsed.tree.stmts[0].stmt.select_stmt.target_list[<x>].res_target.name
b) If there no alias I can use
parsed.tree.stmts[0].stmt.select_stmt.target_list[<x>].res_target.val.column_ref.fields.last.string.sval

Is this the best way to achieve this? I think it works, but it seems incredibly clunky... is there an analog for the filter_columns method that would do the same thing?

Thanks!

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