Skip to content

fix cross join test and add docs#776

Open
raayu83 wants to merge 1 commit intokayak:masterfrom
raayu83:crossjoin-tweaks
Open

fix cross join test and add docs#776
raayu83 wants to merge 1 commit intokayak:masterfrom
raayu83:crossjoin-tweaks

Conversation

@raayu83
Copy link
Copy Markdown

@raayu83 raayu83 commented Dec 2, 2023

Fixes the cross join test (cross joins don't have an on clause) and adds documentation that you need to use .cross() after a cross_join().

@raayu83 raayu83 requested a review from a team as a code owner December 2, 2023 00:07

with self.subTest("join function"):
query = Query.from_(self.table0).cross_join(self.table1).on(self.table0.foo == self.table1.bar).select("*")
query = Query.from_(self.table0).cross_join(self.table1).cross().select("*")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This might be an API design item, but why does cross and cross_join have to be called?
Does cross take arguments?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This method must be called for return self of Query instance and able to continue make Build query

@raayu83
Copy link
Copy Markdown
Author

raayu83 commented Jan 18, 2024

I don't know why it is like this since I didn't implement this, but as pypika is now this is AFAIK the correct way to do a cross join.

@williambdean
Copy link
Copy Markdown
Contributor

I don't know why it is like this since I didn't implement this, but as pypika is now this is AFAIK the correct way to do a cross join.

Do you think omitting it is more intuitive? If so, feel free to make a change in that direction

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