This is an automated email from the ASF dual-hosted git repository.

kamilbregula pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/master by this push:
     new 867bc44  Add type annotations to providers/vertica (#9936)
867bc44 is described below

commit 867bc44acaae71a8121310931b75cab7423fc8b0
Author: Johan Eklund <[email protected]>
AuthorDate: Thu Jul 23 02:00:24 2020 +0100

    Add type annotations to providers/vertica (#9936)
    
    Co-authored-by: Johan Eklund <[email protected]>
---
 airflow/providers/vertica/hooks/vertica.py     |  6 +++---
 airflow/providers/vertica/operators/vertica.py | 10 +++++++---
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/airflow/providers/vertica/hooks/vertica.py 
b/airflow/providers/vertica/hooks/vertica.py
index 91aa682..96cce40 100644
--- a/airflow/providers/vertica/hooks/vertica.py
+++ b/airflow/providers/vertica/hooks/vertica.py
@@ -31,11 +31,11 @@ class VerticaHook(DbApiHook):
     default_conn_name = 'vertica_default'
     supports_autocommit = True
 
-    def get_conn(self):
+    def get_conn(self) -> connect:
         """
-        Returns verticaql connection object
+        Return verticaql connection object
         """
-        conn = self.get_connection(self.vertica_conn_id)  # pylint: 
disable=no-member
+        conn = self.get_connection(self.vertica_conn_id)  # type: ignore # 
pylint: disable=no-member
         conn_config = {
             "user": conn.login,
             "password": conn.password or '',
diff --git a/airflow/providers/vertica/operators/vertica.py 
b/airflow/providers/vertica/operators/vertica.py
index 6b80481..a967950 100644
--- a/airflow/providers/vertica/operators/vertica.py
+++ b/airflow/providers/vertica/operators/vertica.py
@@ -15,6 +15,8 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+from typing import Any, Dict, List, Union
+
 from airflow.models import BaseOperator
 from airflow.providers.vertica.hooks.vertica import VerticaHook
 from airflow.utils.decorators import apply_defaults
@@ -22,7 +24,7 @@ from airflow.utils.decorators import apply_defaults
 
 class VerticaOperator(BaseOperator):
     """
-    Executes sql code in a specific Vertica database
+    Executes sql code in a specific Vertica database.
 
     :param vertica_conn_id: reference to a specific Vertica database
     :type vertica_conn_id: str
@@ -37,12 +39,14 @@ class VerticaOperator(BaseOperator):
     ui_color = '#b4e0ff'
 
     @apply_defaults
-    def __init__(self, sql, vertica_conn_id='vertica_default', *args, 
**kwargs):
+    def __init__(self, sql: Union[str, List[str]],
+                 vertica_conn_id: str = 'vertica_default',
+                 *args: Any, **kwargs: Any) -> None:
         super().__init__(*args, **kwargs)
         self.vertica_conn_id = vertica_conn_id
         self.sql = sql
 
-    def execute(self, context):
+    def execute(self, context: Dict[Any, Any]) -> None:
         self.log.info('Executing: %s', self.sql)
         hook = VerticaHook(vertica_conn_id=self.vertica_conn_id)
         hook.run(sql=self.sql)

Reply via email to