Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow schema from variable name in @row #9

Closed
ericphanson opened this issue Jun 25, 2021 · 2 comments
Closed

Allow schema from variable name in @row #9

ericphanson opened this issue Jun 25, 2021 · 2 comments

Comments

@ericphanson
Copy link
Member

I've been finding it helpful to add write_table-type functions to automatically add a project-specific schema, and therefore would like to do things like:

const MySchema = Legolas.Schema("my-schema@1")
const MyRow = Legolas.@row(MySchema, a::Int)

function write_table(path_or_io, table; kwargs...)
    Legolas.write(path_or_io, table, MySchema; kwargs...)
end

However, Legolas.@row requires a hard-coded schema name there, not the MySchema variable. It would be nice if this could be generalized. I'm not sure if this is even possible because I don't know think the value of MySchema is available at macro-expansion time. But it is a pain point so I figured I'd open an issue for discussion.

@jrevels
Copy link
Member

jrevels commented Jun 26, 2021

Hmm I see what you mean.

I don't think I hit this whenever I work with Schemas since I generally prefer "spelling" a-priori-known Schema values as literals instead of rebinding them to a const.

That being said, I'm not opposed to supporting something like this if the implementation can be sussed out

@jrevels
Copy link
Member

jrevels commented Nov 2, 2022

I think this can be closed after #54

@jrevels jrevels closed this as completed Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants