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

Use handler in run_sql #1773

Merged
merged 6 commits into from
Feb 20, 2023
Merged

Use handler in run_sql #1773

merged 6 commits into from
Feb 20, 2023

Conversation

rajaths010494
Copy link
Contributor

@rajaths010494 rajaths010494 commented Feb 17, 2023

Please describe the feature you'd like to see
Currently, the handler param in the run_sql() method is only used in data bricks all other databases are not using it, which leads to different response types since the handler is processed within run_sql() for data bricks and not for other databases. Also, the signature of run_sql() in data bricks deviates from the base. We need to standardize and when we do, we can remove the below check as well.

Describe the solution you'd like
Ideally, we should have the same signatures for all the run_sql() database implementations. This will prevent adding explicit conditions for data bricks in other parts of the code that should ideally be database agnostic.
example:

if self.handler and self.database_impl.sql_type == "delta":

Acceptance Criteria

  • Where ever we have used run_sql(), we shouldn't be having any database-specific checks.

closes #1664

@codecov
Copy link

codecov bot commented Feb 17, 2023

Codecov Report

Base: 97.72% // Head: 97.72% // No change to project coverage 👍

Coverage data is based on head (58f8ddd) compared to base (3800923).
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1773   +/-   ##
=======================================
  Coverage   97.72%   97.72%           
=======================================
  Files          21       21           
  Lines         835      835           
=======================================
  Hits          816      816           
  Misses         19       19           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Collaborator

@tatiana tatiana left a comment

Choose a reason for hiding this comment

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

Nice to see an alignment of the interface cross-databases, @rajaths010494 ! I'm happy for this change to be merged once the checks are passing.

Since this is a breaking change, we just need to remember to add this to the release notes. WDYT if we already added to the changelog?

@rajaths010494
Copy link
Contributor Author

Nice to see an alignment of the interface cross-databases, @rajaths010494 ! I'm happy for this change to be merged once the checks are passing.

Since this is a breaking change, we just need to remember to add this to the release notes. WDYT if we already added to the changelog?

The changelog PR is not yet created will make sure to add this change to that.

Copy link
Collaborator

@dimberman dimberman left a comment

Choose a reason for hiding this comment

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

Great job @rajaths010494! This all LGTM

@rajaths010494 rajaths010494 merged commit bbea6c6 into main Feb 20, 2023
@rajaths010494 rajaths010494 deleted the add_handler_run_sql branch February 20, 2023 07:10
utkarsharma2 pushed a commit that referenced this pull request Feb 20, 2023
**Please describe the feature you'd like to see**
Currently, the handler param in the run_sql() method is only used in
data bricks all other databases are not using it, which leads to
different response types since the handler is processed within
`run_sql()` for data bricks and not for other databases. Also, the
signature of `run_sql()` in data bricks deviates from the base. We need
to standardize and when we do, we can remove the below check as well.

**Describe the solution you'd like**
Ideally, we should have the same signatures for all the run_sql()
database implementations. This will prevent adding explicit conditions
for data bricks in other parts of the code that should ideally be
database agnostic.
example:
https://github.com/astronomer/astro-sdk/blob/2f8c8d0ccbff3cc13af78685cbefa39f473991c3/python-sdk/src/astro/sql/operators/raw_sql.py#L47

**Acceptance Criteria**
- [ ] Where ever we have used run_sql(), we shouldn't be having any
database-specific checks.

closes #1664
utkarsharma2 pushed a commit that referenced this pull request Feb 21, 2023
**Please describe the feature you'd like to see**
Currently, the handler param in the run_sql() method is only used in
data bricks all other databases are not using it, which leads to
different response types since the handler is processed within
`run_sql()` for data bricks and not for other databases. Also, the
signature of `run_sql()` in data bricks deviates from the base. We need
to standardize and when we do, we can remove the below check as well.

**Describe the solution you'd like**
Ideally, we should have the same signatures for all the run_sql()
database implementations. This will prevent adding explicit conditions
for data bricks in other parts of the code that should ideally be
database agnostic.
example:
https://github.com/astronomer/astro-sdk/blob/2f8c8d0ccbff3cc13af78685cbefa39f473991c3/python-sdk/src/astro/sql/operators/raw_sql.py#L47

**Acceptance Criteria**
- [ ] Where ever we have used run_sql(), we shouldn't be having any
database-specific checks.

closes #1664
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.

Discrepancy in database's run_sql() method
3 participants