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

docs: Add docs for Relation literals #2605

Merged
merged 12 commits into from
May 26, 2023
Merged

Conversation

max-sixty
Copy link
Member

@max-sixty max-sixty commented May 23, 2023

I've combined it with the from_text page, as I think they're similar (and I put these first since I think they're generally better).

One question — do we want any keyword for them — e.g. from_lit {...}? I don't think we necessarily do, but wanted to raise it, since it's the only construction which can be directly in line now.

Is this a reasonable name? Or does it conjure someone saying "They're _literally_ tables" when seeing some large stools?

I've combined it with the `from_text` page, as I think they're similar (and I put these first since I think they're generally better).

One question — do we want any keyword for them — e.g. `from_lit {...}`? I don't think we necessarily do, but wanted to raise it, since it's the only construction which can be directly in line now.
@max-sixty max-sixty changed the title docs: Add docs for "literal tables" docs: Add docs for Relation literals May 23, 2023
@aljazerzen
Copy link
Member

If you want, you can use:

from {[a = 3]}
select a

... because from is already just a noop function. Its only utility is "pulling from database tables" instead of normal name resolution.

I'd say let's not add too much unnecessary functions here.

max-sixty and others added 4 commits May 23, 2023 00:55
Co-authored-by: Aljaž Mur Eržen <aljazerzen@users.noreply.github.com>
Co-authored-by: Aljaž Mur Eržen <aljazerzen@users.noreply.github.com>
Co-authored-by: Aljaž Mur Eržen <aljazerzen@users.noreply.github.com>
@max-sixty
Copy link
Member Author

max-sixty commented May 23, 2023

If you want, you can use:

from {[a = 3]}
select a

... because from is already just a noop function. Its only utility is "pulling from database tables" instead of normal name resolution.

I'm going back & forth on this!

  • from seems incongruent applied to arrays — they're not table names — and from brings tables into the query.
  • But having it bare also seems out-of-place, (image below) — there's no transform bringing the array into the query....
  • But then we introduce another transform from_lit?!
image

FWIW having from was a question we went back & forth on in the very early days of PRQL — I originally just had artists. I think we were correct to make the change — queries look more cohesive with from artists than just artists.

Any thoughts from others?

Otherwise I guess we go with the existing state and see how we feel... I don't have much beyond aesthetics here, so we shouldn't wait at all.


FWIW let makes it look more reasonable (but we obv can't have different semantics inside & outside a declaration)

image

@eitsupi
Copy link
Member

eitsupi commented May 23, 2023

My preference is starting with from. (The word "lit" does not seem very clear to me.)

Given things like from foo.csv and from df (df is pandas.DataFame on Python) in DuckDB, I wouldn't mind putting something other than table name after from.

@max-sixty
Copy link
Member Author

My preference is starting with from. (The word "lit" does not seem very clear to me.)

Given things like from foo.csv and from df (df is pandas.DataFame on Python) in DuckDB, I wouldn't mind putting something other than table name after from.

This resonates with me...

@max-sixty
Copy link
Member Author

Merging this; with a note on us considering from...

@max-sixty max-sixty enabled auto-merge (squash) May 26, 2023 07:00
@max-sixty max-sixty merged commit 26cd9af into PRQL:main May 26, 2023
@max-sixty max-sixty deleted the docs-literal branch May 26, 2023 07:11
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

Successfully merging this pull request may close these issues.

3 participants