Skip to content

Conversation

magiskboy
Copy link
Contributor

No description provided.

@magiskboy magiskboy requested review from twheys and a team as code owners February 4, 2021 10:00
@coveralls
Copy link

coveralls commented Feb 4, 2021

Coverage Status

Coverage increased (+0.006%) to 98.312% when pulling 7fb5127 on magiskboy:subquery-in-function into d8ed544 on kayak:master.

@x8lucas8x
Copy link
Contributor

That seems to be a duplicate of #566. I'd merge this if the conflicts are addressed. Or #566 in case the author adds tests.

@magiskboy
Copy link
Contributor Author

magiskboy commented Mar 13, 2021

Why? This pr is more early than #566. I also add test fully

@x8lucas8x
Copy link
Contributor

@magiskboy like I said there is a conflict in this, so I cannot merge it now. Either you fix it or #566 adds tests. I'll merge whatever happens first.

pypika/terms.py Outdated
name=self.name,
args=",".join(self.get_arg_sql(arg, **kwargs) for arg in self.args),
args=",".join(
p.get_sql(with_alias=False, subquery=True, **kwargs) if hasattr(p, "get_sql") else str(p)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please keep using self.get_arg_sql(arg, **kwargs) for the non subquery case as before? Its implementation isn't exactly equal to str(p).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that this function get_function_sql is called if once this is a sub-query, but not all of the terms

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because function is only used in subquery

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure I understood you. I mean changing:

args=",".join( p.get_sql(with_alias=False, subquery=True, **kwargs) if hasattr(p, "get_sql") else str(p)

to:

args=",".join( p.get_sql(with_alias=False, subquery=True, **kwargs) if hasattr(p, "get_sql") else self.get_arg_sql(arg, **kwargs)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what is arg? I can't see it

Copy link
Contributor

Choose a reason for hiding this comment

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

You've changed arg to p, as you can see in diff. So that's essentially the element from the self.args, which we are iterating.

Copy link
Contributor

Choose a reason for hiding this comment

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

Arg is a better variable name in this case btw.

Copy link
Contributor

@x8lucas8x x8lucas8x left a comment

Choose a reason for hiding this comment

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

See comments.

Copy link
Contributor

@x8lucas8x x8lucas8x left a comment

Choose a reason for hiding this comment

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

Wonderful.

@x8lucas8x x8lucas8x merged commit 7d0bc58 into kayak:master Mar 24, 2021
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