vfq-cdp-operators 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ Metadata-Version: 2.4
2
+ Name: vfq_cdp_operators
3
+ Version: 0.0.1
4
+ Summary: Custom Hive Operator for CDE
5
+ Author-email: Data Team <admin@example.com>
6
+ Requires-Python: >=3.7
7
+ Requires-Dist: apache-airflow-providers-common-sql==1.7.0
8
+ Requires-Dist: apache-airflow>=2.0
File without changes
@@ -0,0 +1,20 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "vfq_cdp_operators"
7
+ version = "0.0.1"
8
+ authors = [
9
+ { name="Data Team", email="admin@example.com" },
10
+ ]
11
+ description = "Custom Hive Operator for CDE"
12
+ readme = "README.md"
13
+ requires-python = ">=3.7"
14
+ dependencies = [
15
+ "apache-airflow>=2.0",
16
+ "apache-airflow-providers-common-sql==1.7.0"
17
+ ]
18
+
19
+ [tool.hatch.build.targets.wheel]
20
+ packages = ["src/vfq_operators"]
@@ -0,0 +1 @@
1
+ from .hive_custom import HiveSQLExecuteQueryOperator
@@ -0,0 +1,25 @@
1
+ from airflow.providers.common.sql.operators.sql import SQLExecuteQueryOperator
2
+
3
+ class HiveSQLExecuteQueryOperator(SQLExecuteQueryOperator):
4
+ """
5
+ Custom Hive Operator that automatically strips trailing semicolons
6
+ from split statements to avoid Hive ParseExceptions.
7
+ """
8
+ def execute(self, context):
9
+ # 1. If SQL is passed as a raw string (file content or raw SQL), split manually
10
+ if isinstance(self.sql, str):
11
+ # Split by semicolon, clean whitespace, and remove the trailing semicolon
12
+ self.sql = [
13
+ s.strip().rstrip(';')
14
+ for s in self.sql.split(';')
15
+ if s.strip()
16
+ ]
17
+ # We handled splitting manually, so turn off the default splitter
18
+ self.split_statements = False
19
+
20
+ # 2. If SQL is already a list (rare, but possible), just clean it
21
+ elif isinstance(self.sql, list):
22
+ self.sql = [s.strip().rstrip(';') for s in self.sql if s.strip()]
23
+
24
+ # 3. Pass the cleaned SQL to the standard operator logic
25
+ return super().execute(context)