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

Ambiguous name error using append #5055

Open
richb-hanover opened this issue Dec 15, 2024 · 1 comment
Open

Ambiguous name error using append #5055

richb-hanover opened this issue Dec 15, 2024 · 1 comment

Comments

@richb-hanover
Copy link
Contributor

What's up?

I want to isolate a column from each of two tables, then work with the result. I crafted the query below to assign the column from one table to table1 and the other to table2, with the intent to append the results.

The query below gives "Ambiguous name" the PRQL Playground, compiler version:0.13.2

Commenting out both derive statements (which I added to identify the source of the "land use" code) gives the expected (single) column of values. And viewing either of the tables on their own (no append statement) works as expected.

My questions:

  1. Is this expected behavior?
  2. If so, why? (I am still very much a newcomer to SQL and PRQL...)
  3. Is there a better way to do this?
  4. Is there a workaround?

Many thanks.

let table1 = (
    from ScrapedData
    select { sd=SD_Land_Use_Code }
    derive source="SD"
    group { sd } (
        take 1
       )
    sort { sd }
)

let table2 = (
    from SpecialLand
    select { sd = SL_Code }
    derive source = "SL"
    group { sd } (
        take 1
    )
    sort { sd }
)

from table1
append table2
@richb-hanover
Copy link
Contributor Author

richb-hanover commented Dec 22, 2024

@lukapeschke has fixed #4947. (Thanks!) For a lark, I rewrote that original query in #4947 (comment) to define two separate tables then used from a | append b. This works both in the current Playground and the post-fix Playground.

The form of this issue (#5055, above) is remarkably similar to that re-written query. Can anyone see the why this query generates the "Ambiguous name" error? Thanks.

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

1 participant