-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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 Core SQL Provider #24476
Add Core SQL Provider #24476
Conversation
@kaxil @potiuk @mik-laj I'm not sure why these remaining checks are failing -- one seems to be for an Airflow doc I didn't touch, and the other is a breeze output. |
Please rebase to latest main. You are 28 commits behind the main. So the changes might come from outdated code your PR is based on. This should always be the first thing you do when you see failures that you don't recognize. |
Rbase early, rebase often is the mantra that everyone should follow. BTW. You cna do it easily with the drop-down next to "Update banch" at the bottom here. |
271b948
to
ddd1da0
Compare
@potiuk rebased a few times now, still seeing these errors. |
Yes. you need to install pre-commit and run those pre-commits locally to fix them. Those are real problems. Also your docs have errors to be fixed. |
Ok. I do have pre-commit installed and it definitely was running before all my commits, which is why I was so confused about the errors, because other errors did come up in pre-commit that I fixed before pushing anything.
|
Besides - you might have to run the same as is done in It looks like in this case the problem is with images conflicting as command line "help" because someone (likely me) added another command so you have now conflicting images in yours and main version. You wlll need to run |
dea3e6e
to
8353938
Compare
BTW: @denimalpaca -> #24581 I've added better instructions in both - the file that might get conflicted if multiple people modify breeze commands at the same time as well in the error message printed by pre-commit. It will explicittly tel you to run |
BTW @denimalpaca I just merged #24581 - so actually you might need to rebase again (and this time you should get the right instuctions when you get conflict!) |
7382861
to
ca8e87a
Compare
@potiuk still not sure why tests are failing... now it's a |
ca8e87a
to
26896b9
Compare
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.
I don't think the location /providers/core
is appropriate because core
doesn't really give much information. Maybe we should move all the SQL operators in airflow.operator
into the providers package at /providers/sql
?
Though, I don't really know why the SQL operators are still in core airflow, so it's something to check
There are some issues with having a |
The idea of
This is reasoning behind the idea - happy to hear about any comments but just wanted to provide a context here. |
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.
@potiuk, your explanation makes sense to me and I can't think of a better name.
Adds operators, tests, and new and updated docs for a Core SQL Provider. This provider is made in favor of adding these operators to the existing SQL operators in core Airflow. The new provider will allow for quicker development cycles.
I am bad at git and this change got overwritten during a git pull with the remote branch. Add Core SQL Provider Adds operators, tests, and new and updated docs for a Core SQL Provider. This provider is made in favor of adding these operators to the existing SQL operators in core Airflow. The new provider will allow for quicker development cycles. Fix build doc errors Fix capitalization and grammar errors in doc
This shouldn't actually matter; because the `check_values` options are checked before this code is executed, there will always be some path to exit the function, whether it's a catch-all `return` at the end of the function as it was, or whether `equal_to` is checked last and the inner `if` doesn't run like the change suggests. Co-authored-by: Ephraim Anierobi <[email protected]>
Static checks require an always-accessible return statement.
The logic in _get_match() was previously short-circuiting after one value check, however, multiple value checks per check type are permitted. The logic is updated to ensure all value checks are run and that any failure is propogated through the subsequent checks. Additional tests are added to ensure proper logic.
e269d29
to
f225249
Compare
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.
Some minor comments, going to merge this, feel free to take care of the other comments in a follow-up PR please
@@ -0,0 +1,16 @@ | |||
# Licensed to the Apache Software Foundation (ASF) under one |
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.
I am not a fan of "core.sql" too like @ephraimbuddy -- maybe "base.sql" is better 🤷 but I do know that there already is a BaseSQLOperator -- which we should think of moving to a provider too tbh.
But naming is heard. tagging a few people if they have better suggestions for names: @dstandish @jedcunningham @uranusjr
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.
Maybe "common" would be better than "core"?
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.
We can still change it - before we release the provider and I think we should only do it after we move DBApiHook there (as explained in #23971).
I think common might be a better choice indeed.
if not records: | ||
raise AirflowException(f"The following query returned zero rows: {self.sql}") | ||
|
||
self.log.info(f"Record: {records}") |
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.
self.log.info(f"Record: {records}") | |
self.log.info("Record: %s", records) |
.. code-block:: python | ||
|
||
{ | ||
"row_count_check": {"check_statement": "COUNT(*) = 1000"}, | ||
"column_sum_check": {"check_statement": "col_a + col_b < col_c"}, | ||
} | ||
|
||
:param conn_id: the connection ID used to connect to the database |
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.
I think this should be indented further, not sure though, can you post a screenshot of how this looks in 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.
Is that built if I run breeze build-docs
? I can't seem to find a preview anywhere (and not sure that putting in a separate markdown file to preview is going to be an accurate reflection of this).
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.
Yes. when you run breeze build-docs --package-filter apache-airlfow-provider-core-sql
and run ./docs/start-docs-server.sh
or something - you should see the docs (it's described in contributing docs I am quite sure of that)
if not records: | ||
raise AirflowException(f"The following query returned zero rows: {self.sql}") | ||
|
||
self.log.info(f"Record: {records}") |
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.
self.log.info(f"Record: {records}") | |
self.log.info("Record: %s", records) |
Adds operators, tests, and new and updated docs for a Core SQL
Provider. This provider is made in favor of adding these operators
to the existing SQL operators in core Airflow. The new provider
will allow for quicker development cycles.
closes: #23874, #24422
related: #23915