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

feat(ingest/powerbi): support PowerBI parameter references #7523

Merged
merged 5 commits into from
Mar 9, 2023

Conversation

hsheth2
Copy link
Collaborator

@hsheth2 hsheth2 commented Mar 9, 2023

Right now this only works for non-admin API. Implementing this for the admin API interface will require additional investigation.

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable). If a new feature has been added a Usage Guide has been added for the same.
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Updating DataHub

@github-actions github-actions bot added the ingestion PR or Issue related to the ingestion of metadata label Mar 9, 2023
parse_tree: Tree = lark_parser.parse(expression)
# Replace U+00a0 NO-BREAK SPACE with a normal space.
# Sometimes PowerBI returns expressions with this character and it breaks the parser.
expression = expression.replace("\u00a0", " ")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious how the heck you found this.. nice!

logger.debug(f"Actual Value = {actual_value}")
logger.debug(f"Expected Value = {variable}")
if TRACE_POWERBI_MQUERY_PARSER:
logger.debug(f"Actual Value = {actual_value}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want a higher level here if tracing is enabled?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if they have trace enabled, they probably should have debug too. I expect the trace stuff will only be useful in dev so it should be fine

identifier = node.children[0].children[0]
assert isinstance(identifier, Token)

ref = identifier.value # ref will have quotes around it.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for quoted_identifier yes, but i've added a more detailed comment around this

aspect=upstream_lineage,
)
mcps.append(mcp)
if len(upstreams) > 0:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this unindent intentional? was this just a bug?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was intentional, fixing a subtle bug where if there were two upstreams then we'd emit two upstreamLineage mcps instead of a single one

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh wow. thanks!

Copy link
Collaborator

@jjoyce0510 jjoyce0510 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Minor comments otherwise looks great! Big improvement for other folks using PowerBI.

@@ -426,7 +432,7 @@ each_expression: "each" WS_INLINE each_expression_body

each_expression_body: function_body

let_expression: "let" NEWLINE WS_INLINE? variable_list WS_INLINE? NEWLINE? in_expression
let_expression: "let" whitespace variable_list WS_INLINE? NEWLINE? in_expression
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this change safe?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes - this lets you put whitespace before/after the newline, and also lets you put let Source = ... on the same line

all of these are valid m-query so we have to match it

@hsheth2 hsheth2 merged commit 91a8e5e into datahub-project:master Mar 9, 2023
@hsheth2 hsheth2 deleted the powerbi-parameters branch March 9, 2023 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ingestion PR or Issue related to the ingestion of metadata
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants