Skip to content

[AIRFLOW-1595] Change to construct sqlite_hook from connection schema#2598

Closed
mrkm4ntr wants to merge 1 commit intoapache:masterfrom
mrkm4ntr:airflow-1595
Closed

[AIRFLOW-1595] Change to construct sqlite_hook from connection schema#2598
mrkm4ntr wants to merge 1 commit intoapache:masterfrom
mrkm4ntr:airflow-1595

Conversation

@mrkm4ntr
Copy link
Contributor

Dear Airflow maintainers,

Please accept this PR. I understand that it will not be reviewed until I have checked off all the steps below!

JIRA

Description

  • Here are some details about my PR, including screenshots of any UI changes:
    SqliteHook is built using the host attribute of connection, but correctly we should use the schema attribute. The connection created from URI has no host attribute.

Tests

  • My PR adds the following unit tests OR does not need testing for this extremely good reason:
  • tests/hooks/test_sqlite_hook.py

Commits

  • My commits all reference JIRA issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "How to write a good git commit message":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not "adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

@codecov-io
Copy link

codecov-io commented Sep 12, 2017

Codecov Report

Merging #2598 into master will decrease coverage by 5.5%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2598      +/-   ##
==========================================
- Coverage   76.47%   70.96%   -5.51%     
==========================================
  Files         203      150      -53     
  Lines       15012    11607    -3405     
==========================================
- Hits        11480     8237    -3243     
+ Misses       3532     3370     -162
Impacted Files Coverage Δ
airflow/utils/db.py 84.55% <ø> (+50.68%) ⬆️
airflow/hooks/sqlite_hook.py 100% <100%> (ø) ⬆️
airflow/operators/redshift_to_s3_operator.py 0% <0%> (-95.46%) ⬇️
airflow/hooks/jdbc_hook.py 0% <0%> (-94.45%) ⬇️
airflow/operators/s3_file_transform_operator.py 0% <0%> (-93.62%) ⬇️
airflow/executors/celery_executor.py 0% <0%> (-85.49%) ⬇️
airflow/hooks/S3_hook.py 22.27% <0%> (-72.32%) ⬇️
airflow/hooks/mssql_hook.py 6.66% <0%> (-66.67%) ⬇️
airflow/utils/log/s3_task_handler.py 37.5% <0%> (-61.08%) ⬇️
airflow/hooks/hdfs_hook.py 32.5% <0%> (-60%) ⬇️
... and 200 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4ce2502...c4d9b6d. Read the comment docs.

@mrkm4ntr mrkm4ntr changed the title [AIRFLOW-1595] Change to construct SqlHook from connection schema [AIRFLOW-1595] Change to construct sqlite_hook from connection schema Sep 24, 2017
@ashb
Copy link
Member

ashb commented Sep 20, 2018

To resurrect an old PR: This PR might make sense, but as it is it would break any existing connections that are defined.

The issue is probably around how the connections are created. If for instance I create a connection like this airflow connections -a --conn_id foo --conn_uri sqlite://path/to/file.sqlite then I end up with {"host": "path", "schema": "to/file.sqlite"} so the fix wouldn't actually help for this case either.

The new options added recently (1.9.0, 1.10.0?) to be able to directly specify --conn_host probably make this PR as structured not needed, and a doc change in the SqliteHook all that is needed. (I'm not expecting you to do that, just commenting)

@stale
Copy link

stale bot commented Dec 10, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Dec 10, 2018
@stale stale bot closed this Dec 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale Stale PRs per the .github/workflows/stale.yml policy file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants