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

Implement F&R for native queries with references to other cards #42582

Closed
Tracked by #36911
tsmacdonald opened this issue May 13, 2024 · 1 comment · Fixed by #42939
Closed
Tracked by #36911

Implement F&R for native queries with references to other cards #42582

tsmacdonald opened this issue May 13, 2024 · 1 comment · Fixed by #42939
Assignees
Milestone

Comments

@tsmacdonald
Copy link
Member

No description provided.

@tsmacdonald
Copy link
Member Author

This is a little tricky:

t> (println (:query (:native (:dataset_query cr))))
SELECT * from {{#129-just-plain-orders}}
nil
metabase.native-query-analyzer.replacement> (println (replace-names cr {:columns {"source"     "referral"
                                                                                  "birth_date" "birthday"}
                                                                        :tables {"people" "folk"}}))
{:t SELECT * from }
{:t (params/->Param #129-just-plain-orders)}
{:t nil}
Execution error (ParseException) at net.sf.jsqlparser.parser.CCJSqlParser/generateParseException (CCJSqlParser.java:39603).
Encountered unexpected token: "from" "FROM"
    at line 1, column 10.

Was expecting one of:

    <EOF>
    <ST_SEMICOLON>

metabase.native-query-analyzer.replacement> (params/ReferencedCardQuery? xt)
false
metabase.native-query-analyzer.replacement> xt
(params/->Param "#129-just-plain-orders")

I would've expected the token to be a ReferencedCardQuery, but it's not. I think this might require bringing in the param->value stuff?

@tsmacdonald tsmacdonald self-assigned this May 20, 2024
tsmacdonald added a commit that referenced this issue May 21, 2024
tsmacdonald added a commit that referenced this issue May 21, 2024
tsmacdonald added a commit that referenced this issue May 21, 2024
tsmacdonald added a commit that referenced this issue May 22, 2024
tsmacdonald added a commit that referenced this issue May 22, 2024
* Handle native query find-and-replace for queries with card refs

[Fixes #42582]

c.f. limitiations in #42938

* wee cleanup
@tsmacdonald tsmacdonald added this to the 0.50 milestone May 22, 2024
oisincoveney pushed a commit that referenced this issue May 22, 2024
* Handle native query find-and-replace for queries with card refs

[Fixes #42582]

c.f. limitiations in #42938

* wee cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant