Граф коммитов

42 Коммитов

Автор SHA1 Сообщение Дата
Kamil Breguła 97a429f9d0
[AIRFLOW-6714] Remove magic comments about UTF-8 (#7338) 2020-02-02 22:18:19 +01:00
Kamil Breguła 059eda05f8
[AIRFLOW-6610] Move software classes to providers package (#7231)
* [AIP-21] Move contrib.hooks.mongo_hook providers.mongo.hooks.mongo

* [AIP-21] Move contrib.hooks.openfaas_hook providers.openfass.hooks.openfaas

* [AIP-21] Move contrib.hooks.redis_hook providers.redis.hooks.redis

* [AIP-21] Move contrib.operators.docker_swarm_operator providers.docker.operators.docker_swarm

* [AIP-21] Move contrib.operators.redis_publish_operator providers.redis.operators.redis_publish

* [AIP-21] Move contrib.operators.kubernetes_pod_operator providers.cncf.kubernetes.operators.kubernetes_pod

* [AIP-21] Move contrib.sensors.bash_sensor sensors.bash

* [AIP-21] Move contrib.sensors.celery_queue_sensor providers.celery.sensors.celery_queue

* [AIP-21] Move contrib.sensors.mongo_sensor providers.mongo.sensors.mongo

* [AIP-21] Move contrib.sensors.python_sensor sensors.python

* [AIP-21] Move contrib.sensors.redis_key_sensor providers.redis.sensors.redis_key

* [AIP-21] Move contrib.sensors.redis_pub_sub_sensor providers.redis.sensors.redis_pub_sub

* [AIP-21] Move hooks.docker_hook providers.docker.hooks.docker

* [AIP-21] Move hooks.mssql_hook providers.microsoft.mssql.hooks.mssql

* [AIP-21] Move hooks.mysql_hook providers.mysql.hooks.mysql

* [AIP-21] Move hooks.oracle_hook providers.oracle.hooks.oracle

* [AIP-21] Move hooks.postgres_hook providers.postgres.hooks.postgres

* [AIP-21] Move hooks.presto_hook providers.presto.hooks.presto

* [AIP-21] Move hooks.samba_hook providers.samba.hooks.samba

* [AIP-21] Move hooks.sqlite_hook providers.sqlite.hooks.sqlite

* [AIP-21] Move operators.bash_operator operators.bash

* [AIP-21] Move operators.docker_operator providers.docker.operators.docker

* [AIP-21] Move operators.mssql_operator providers.microsoft.mssql.operators.mssql

* [AIP-21] Move operators.mysql_operator providers.mssql.operators.mysql

* [AIP-21] Move operators.oracle_operator providers.oracle.operators.oracle

* [AIP-21] Move operators.papermill_operator providers.papermill.operators.papermill

* [AIP-21] Move operators.postgres_operator providers.postgres.operators.postgres

* [AIP-21] Move operators.presto_check_operator providers.presto.operators.presto_check

* [AIP-21] Move operators.python_operator operators.python

* [AIP-21] Move operators.sqlite_operator providers.sqlite.operators.sqlite

* Update docs
2020-01-21 18:00:52 +01:00
dstandish 776e24aa05 [AIRFLOW-5768] GCP cloud sql don't store ephemeral connection in db (#6440) 2019-11-14 17:40:29 +01:00
MinJae Kwon 729ba3cb82 [AIRFLOW-5758] Support the custom cursor classes for the PostgreSQL hook (#6432) 2019-11-02 11:32:07 +01:00
Kevin Yang d719e1fd67 [AIRFLOW-5362] Reorder imports (#5944) 2019-10-02 16:30:03 +01:00
Cooper Gillan f823a66001 [AIRFLOW-3705] Fix PostgresHook get_conn to use conn_name_attr (#5841)
Update PostgresHook's get_conn method to directly call the specified
conn_name_attr rather that always using self.postgres_conn_id.

Currently subclassing PostgresHook requires overriding the
postgres_conn_id attribute in order to establish a separate connection.

Add an additional unit test for this case checking that the subclassed
PostgresHook's get_conn calls the correct arguments and that the hook
calls the correction connection_id in get_connection.
2019-08-28 14:23:10 +02:00
Kamil Breguła d5a5b9d9f1 [AIRFLOW-4836] Fix pylint errors regarding file opening (#5463) 2019-06-23 21:46:01 +02:00
Andrew Harmon 373c945873 [AIRFLOW-4417] Add AWS IAM authenication for PostgresHook (#5223)
Enhance the exisitng PostgresHook to allow for IAM authentication for
RDS Postgres and Redshift.
2019-05-03 11:56:19 +01:00
Chao-Han Tsai e62ad5333c [AIRFLOW-4204] Update super() calls (#5143)
Replace super(_class, self) by super() for all files
except ones in _vendor.
2019-04-24 08:16:11 +02:00
Kengo Seki c27098b8d3 [AIRFLOW-59] Implement bulk_dump and bulk_load for the Postgres hook
This PR implements bulk_dump and bulk_load,
which are inherited from DbApiHook and
already implemented for MySqlHook.

Closes #3456 from sekikn/AIRFLOW-59
2018-06-09 22:14:51 +02:00
Kengo Seki e5fb9c7998 [AIRFLOW-2525] Fix a bug introduced by commit dabf1b9
The previous commit on this issue (#3421)
introduced a new bug on COPY FROM operation.
This PR fixes it by opening a file with 'r+'
mode instead of 'w+' to avoid truncating it.

Closes #3423 from sekikn/AIRFLOW-2525-2
2018-06-03 15:03:05 +02:00
Kengo Seki dabf1b962d [AIRFLOW-2525] Fix PostgresHook.copy_expert to work with "COPY FROM"
For now PostgresHook.copy_expert supports
"COPY TO" but not "COPY FROM", because it
opens a file with write mode and doesn't
commit operations. This PR fixes it by
opening a file with read and write mode
and committing operations at last.
2018-05-25 10:52:14 -04:00
Kaxil Naik 1f0a717b65 [AIRFLOW-2502] Change Single triple quotes to double for docstrings
- Changed single triple quotes to double quote
characters to be consistent with the docstring
convention in PEP 257

Closes #3396 from kaxil/AIRFLOW-2502
2018-05-21 23:22:35 +02:00
Bolke de Bruin c7a472ed6b [AIRFLOW-2287] Fix incorrect ASF headers
Closes #3219 from bolkedebruin/fix_header
2018-04-14 09:13:23 +02:00
Ace Haidrey 97ca9791c3 [AIRFLOW-2017][Airflow 2017] adding query output to PostgresOperator
Make sure you have checked _all_ steps below.

### JIRA
- [x] My PR addresses the following [Airflow 2017]
(https://issues.apache.org/jira/browse/AIRFLOW-201
7/) issues and references them in the PR title.
For example, "[AIRFLOW-2017] My Airflow PR"
    -
https://issues.apache.org/jira/browse/AIRFLOW-2017

### Description
- [x] Here are some details about my PR, including
screenshots of any UI changes:
Currently we're not getting the output logs of the
postgres operator that you would get otherwise if
you ran a psql command. It's because the postgres
conn has an attribute called [notices](http://init
d.org/psycopg/docs/connection.html#connection.noti
ces) which contains this information.
We need to just print the results of this to get
that output in the airflow logs, which makes it
easy to debug amongst other things.

I've included some images for before and after
pictures.
**BEFORE**
<img width="1146" alt="screen shot 2018-01-19 at 4
46 59 pm" src="https://user-images.githubuserconte
nt.com/10408007/35178405-6f6a1da8-fd3d-11e7-8f50-0
dbd567d8ab4.png">
**AFTER**
<img width="1147" alt="screen shot 2018-01-19 at 4
46 25 pm" src="https://user-images.githubuserconte
nt.com/10408007/35178406-74ea4ae6-fd3d-11e7-9551-6
31eac6bfe7b.png">

### Tests
- [x] My PR adds the following unit tests __OR__
does not need testing for this extremely good
reason:
There isn't anything to test, there is nothing
changing to the current implementation besides an
addition of logging.

### Commits
- [x] 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](http://chris.beams.io/posts/git-
commit/)":
    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"

- [x] Passes `git diff upstream/master -u --
"*.py" | flake8 --diff`

Closes #2959 from Acehaidrey/AIRFLOW-2017
2018-01-20 10:05:16 +01:00
Andy Hadjigeorgiou 6372770be6 [AIRFLOW-1726] Add copy_expert psycopg2 method to PostgresHook
Executes SQL using psycopg2 copy_expert method
Necessary to execute COPY command without access to a superuser

Closes #2698 from andyxhadji/AIRFLOW-1726
2017-10-19 20:50:52 +02:00
Bolke de Bruin 05bdd74131 [AIRFLOW-1668] Expose keepalives_idle for Postgres connections
Controls the number of seconds of inactivity after
which TCP
should send a keepalive message to the server.
A value of zero uses the system default.

Important for Redshift which requires a setting
lower than 300.

Closes #2650 from bolkedebruin/AIRFLOW-1688
2017-10-02 17:12:27 +02:00
Niels Zeilemaker 3b589a9f73 [AIRFLOW-1170] DbApiHook insert_rows inserts parameters separately
Instead of creating a sql statement with all
values, we send the values
separately to prevent sql injection

Closes #2270 from NielsZeilemaker/AIRFLOW-1170
2017-05-13 14:49:05 +02:00
Richard Lee f5bfda0d64 [AIRFLOW-945][AIRFLOW-941] Remove psycopg2 connection workaround
Closes #2272 from dlackty/AIRFLOW-945
2017-05-04 21:34:38 +02:00
Bolke de Bruin e79dee8718 [AIRFLOW-941] Use defined parameters for psycopg2
This works around
https://github.com/psycopg/psycopg2/issues/517 .

Closes #2126 from bolkedebruin/AIRFLOW-941
2017-03-06 21:03:14 +01:00
Ján Koščo 94dc7fb0a6 [AIRFLOW-858] Configurable database name for DB operators
Closes #2063 from s7anley/configurable-schema
2017-02-12 15:43:41 -05:00
Daniel Zohar ac9167f37b [AIRFLOW-139] Let psycopg2 handle autocommit for PostgresHook
The server-side autocommit setting was removed and reimplemented
in client applications and languages. Server-side autocommit was
causing too many problems with languages and applications that
wanted to control their own autocommit behavior,
so autocommit was removed from the server and added to individual client APIs as appropriate

Closes #1821 from danielzohar/AIRFLOW-
139_vacuum_operator
2017-01-24 15:45:48 +01:00
John Bodley 4fb86f920a [AIRFLOW-179] Fix DbApiHook with non-ASCII chars
String serialization fails when string contains non-ASCII characters

Closes #1553 from
johnbodley/dbapi_hook_serialization-remedy
2016-11-04 09:41:46 -04:00
gtoonstra ac6d42912d [AIRFLOW-609] Add application_name to PostgresHook
Closes #1861 from
gtoonstra/postgres_application_name
2016-11-02 23:30:41 -07:00
jlowin 851adc5547 [AIRFLOW-31] Use standard imports for hooks/operators 2016-06-16 14:55:07 -04:00
Bence Nagy d9b57efd3a Use psycopg2's API for serializing postgres cell values 2016-03-30 13:23:26 +02:00
Bence Nagy 28da05d860 Set Postgres autocommit as supported only if server version is < 7.4
The server-side autocommit setting was removed here http://www.postgresql.org/docs/7.4/static/release-7-4.html

Resolves: #690
2016-03-29 14:14:44 +02:00
Zack Shapiro d1b4572c45 Adding support for ssl parameters. (picking up from jthomas123) 2016-03-17 14:07:37 -07:00
Maxime Beauchemin f1cae05773 Bugfix on postres_hook 2015-07-27 22:12:28 -07:00
Maxime Beauchemin 07b02abfef Setting autocommit default 2015-07-24 13:36:38 -07:00
Maxime Beauchemin 1bfbd752f4 Fixing the conn_ids 2015-07-23 22:44:32 -07:00
Steve Mardenfeld c995cfa07a clean up default_conn_name and conn_name_attr 2015-07-17 15:15:17 -07:00
Steve Mardenfeld 2c38917a8c change base_hook_sql to be dbApiHook and do some more refactoring 2015-07-17 13:52:56 -07:00
Steve Mardenfeld 0daef23e8c make a baseSqlHook and apply it to mysql, postgres, sqlite 2015-07-16 17:04:10 -07:00
Maxime 7091b3d539 Defining AirflowException in place of generic ones 2015-06-14 15:53:07 +00:00
Mike Kerzhner ec2fc4b3e6 Postgres operator unit tests 2015-03-11 16:48:15 -07:00
Mike Kerzhner d77a403720 Default for autocommit 2015-03-06 19:09:42 -08:00
Mike Kerzhner 9aae54dec6 Passing self to setAutocommit 2015-03-06 17:37:29 -08:00
Mike Kerzhner ebd68486c5 Adding postgres setAutocommit 2015-03-06 17:28:05 -08:00
Mike Kerzhner 499587cf19 Adding autocommit setting for Postgres operator 2015-03-06 16:29:22 -08:00
Mike Kerzhner 4ea0483176 Error message cleanup 2015-03-04 10:32:29 -08:00
Mike Kerzhner 7b70d6fd73 Adding postgres operator and hook 2015-03-04 10:24:23 -08:00