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

TSQL support for lateral joins #641

Merged
merged 14 commits into from
Oct 27, 2022
Merged

Conversation

10bas10
Copy link
Contributor

@10bas10 10bas10 commented Oct 26, 2022

Added support for the CROSS APPLY and OUTER APPLY from T-SQL. In order to achieve this I had to add the "view" attribute to make the distinction between LATERAL VIEW and LATERAL JOINS.

sqlglot/dialects/tsql.py Outdated Show resolved Hide resolved
sqlglot/parser.py Outdated Show resolved Hide resolved
sqlglot/dialects/tsql.py Outdated Show resolved Hide resolved
sqlglot/expressions.py Outdated Show resolved Hide resolved
sqlglot/tokens.py Outdated Show resolved Hide resolved
sqlglot/generator.py Outdated Show resolved Hide resolved
sqlglot/parser.py Outdated Show resolved Hide resolved
sqlglot/parser.py Outdated Show resolved Hide resolved
sqlglot/parser.py Outdated Show resolved Hide resolved
sqlglot/dialects/tsql.py Outdated Show resolved Hide resolved
@tobymao
Copy link
Owner

tobymao commented Oct 27, 2022

great, except i'm going to remove the "inner" join as default is just join

@tobymao
Copy link
Owner

tobymao commented Oct 27, 2022

thanks again for the great pr @10bas10

@tobymao tobymao merged commit 2ba418b into tobymao:main Oct 27, 2022
@tobymao
Copy link
Owner

tobymao commented Oct 27, 2022

@10bas10 bd3f07d

@tobymao
Copy link
Owner

tobymao commented Oct 27, 2022

i believe this also fixes a bug because in the previous code, the OUTER was always getting set to False since you always did outer = self._match(TokenType.OUTER)

@10bas10 10bas10 deleted the 10bas10/tsql_lateral branch December 15, 2022 13:58
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