-
Notifications
You must be signed in to change notification settings - Fork 769
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(teradata): add support for the SAMPLE clause #2169
Conversation
Pardon my limited understanding here, but where is tablesample_sql from teradata.py called from? I did not reach that function in my copy of the code |
@Ashay4u it's called from the base generator's |
I added a breakpoint on def tablesample_sql and its return statement in terdata.py file and the code did not stop there during debug. It does not arrive at the breakpoint for tablesample_sql in generator.py during transpile too. Am i missing a change somewhere
|
Can you share your example so I can try to reproduce this? What I've tried so far reaches that code. |
Code below
My code does not stop at tablesample_sql in generator.py too during transpile. Am i missing a change somewhere |
Yeah, it doesn't reach that method because you're transpiling to databricks. That doesn't work currently, I only added support for parsing/generating in Teradata, because the transpilation is out of scope for now. See related comment: #2161 (comment). |
Thanks for clarifying. Where should I make changes to the code to try and fix this? I will try to get this to some acceptable fix |
Ideally you need to parse this into a canonical representation, so that:
From what I saw, in order to implement (2), you need to check what kind of numbers you have in the I see you mentioned |
For my use case, its an acceptable loss. Is there an easy fix for it? |
The fix is not trivial, at least if you're not experienced with SQLGlot's codebase. One idea is to override
See my edit in the above reply too. |
Thanks. Will give it a try. How do I familiarize myself with the codebase details. Is there documentation I can refer or just debug through the code to understand? Again, thanks a lot for being so prompt and helpful |
Sure thing, glad you want to contribute. You can also join our slack btw if you want to chat.
Yeah I'd suggest debugging through the code and looking into past issues & their fixes to understand the work flow. I think the above outline should cover your use case, so try to work around that. |
Motivated by #2161