-
-
Notifications
You must be signed in to change notification settings - Fork 644
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
Add sql backend + sqlfluff linter #20854
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm bar some nits.
Also miss some file headers, which I think will be added if you run pants fmt
(or maybe pants fix
?) by the preamble backend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for an early review!
Fixed the issues
How do I make sure the tests only run for python>=3.8? |
Look at how these have been applied: |
oh, for Sqlfluff, yeah! 🎉 |
Would be great with a few more lines of docs, describing at least briefly how to enable and use this backend :) |
@kaos Sure, added the docs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Thanks for this @grihabor, exciting to have a new useful backend like this. I do have one comment which may not be immediately actionable: I wonder if we actually need targets at all for this sort of backend? It seems like we could just treat all *.sql files appropriately and not have explicit targets (even tailored ones) at all. That said, it would be the first time we'd done something like that, and there may be gotchas, so I don't expect you to make that change. But as I think we should be moving towards that sort of paradigm in the future, this backend might be a good place to experiment with it when we start looking into it. |
Thank you for review!
I don't know, I just did it similar to other backends. Right now we're using this as a plugin and the .sql is actually a python template string which we render in the application. I'm thinking about moving sql rendering directly into pants in the future, so that the application consumes ready to go sql without templating, so I will probably need some codegen with jinja for sql, but I'm not sure it's a good idea yet. |
Ah, right. This is an excellent comment, and also not accurate, as we do have the Sorry for not running on all cylinders here.. failing to make this connection myself. |
|
to be clear, I'm fine keeping this as-is for now as well.. just good to be aware of the alternative to consider going forward :) |
Thanks for the contribution. When you have a chance, please merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
Let's get this in so we can start iterate on it, if needed :)
Just saw this and did a double take because I also have a sqlfluff backend in an in-repo plugin designed to work with dbt. We can definitely reconcile what's here and what we have though. |
No description provided.