datapipelab 0.3.6__py3-none-any.whl → 0.3.7__py3-none-any.whl

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.
@@ -6,16 +6,29 @@ class BigQueryAPIProcessorNode(TNode):
6
6
  super().__init__(spark=spark)
7
7
  self.sql_query = tnode_config['options']['query']
8
8
  self.node_name = tnode_config['name']
9
- self.credentials_path = tnode_config['options']['credentials_path']
9
+ self.credentials_path = tnode_config['options'].get('credentials_path', None)
10
+ self.credentials_info_env_name = tnode_config['options'].get('credentials_info_env_name', None)
10
11
  self.return_as_spark_df = tnode_config['options']['return_as_spark_df']
11
12
  self.project_name = tnode_config['options']['project_name']
12
13
  self.return_as_python_list = tnode_config['options'].get('return_as_python_list', False)
13
14
  self.return_as_is = tnode_config['options'].get('return_as_is', False)
14
15
 
16
+ def __get_gcp_credentials(self):
17
+ from google.oauth2 import service_account
18
+ if self.credentials_path:
19
+ return service_account.Credentials.from_service_account_file(self.credentials_path)
20
+ elif self.credentials_info_env_name:
21
+ import os
22
+ import json
23
+ credentials_info = json.loads(os.environ[self.credentials_info_env_name])
24
+ return service_account.Credentials.from_service_account_info(credentials_info)
25
+ else:
26
+ logger.warning("No credentials provided. Please provide either 'credentials_path' or 'credentials_info'.")
27
+ return None
28
+
15
29
  def __sql_biqquery(self, sql_query):
16
30
  from google.cloud import bigquery
17
- from google.oauth2 import service_account
18
- credentials = service_account.Credentials.from_service_account_file(self.credentials_path)
31
+ credentials = self.__get_gcp_credentials()
19
32
  client = bigquery.Client(credentials=credentials, project=self.project_name)
20
33
 
21
34
  # run the job
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datapipelab
3
- Version: 0.3.6
3
+ Version: 0.3.7
4
4
  Summary: A data pipeline library with connectors, sources, processors, and sinks.
5
5
  Description-Content-Type: text/markdown
6
6
  Requires-Dist: json5
@@ -10,7 +10,7 @@ datapipelab/app/node/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
10
10
  datapipelab/app/node/custom_node.py,sha256=3Se4DweMvm5VK4MTZ-pQSQ_lE_fOm6cGj-wzcqKEU0E,1019
11
11
  datapipelab/app/node/tnode.py,sha256=-2hnQkIuLwEy7xVTig54TByO7L2l7UujolXMQL0CQJA,484
12
12
  datapipelab/app/node/processor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- datapipelab/app/node/processor/bigquery_api_node.py,sha256=IclDkGxo9ltGJVkBaHKFPFCSlEEyzefgalaAOLA17bE,1752
13
+ datapipelab/app/node/processor/bigquery_api_node.py,sha256=wXmdRN9OJv5OvqRbxzIBx-Qhct3iR2TesQEjGFHIOBw,2411
14
14
  datapipelab/app/node/processor/bigquery_spark_node.py,sha256=pklpsqYqztidCIECkl3rpjfY6LiB0p4thvE7-PzBodE,1099
15
15
  datapipelab/app/node/processor/custom_node.py,sha256=1nqbJEhNiMP1rmN9ufpUuKO1IkuI2BEM5auW4JceGMA,933
16
16
  datapipelab/app/node/processor/gcp_bucket_node.py,sha256=bzV2c89-g5S0OH5bcKKQ-9yKOGwlmOR7h7_5uO6Gnq0,1904
@@ -31,7 +31,7 @@ datapipelab/app/node/source/spark_api_node.py,sha256=SSJW3PnuqdHPbC57pIvBSmJXoDv
31
31
  datapipelab/app/node/source/spark_node.py,sha256=TDfezmlk8Ts2YTGkB92-God_AyGVUslTUoevXolN7W8,532
32
32
  datapipelab/app/wrapper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
33
  datapipelab/app/wrapper/source/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
- datapipelab-0.3.6.dist-info/METADATA,sha256=zCGgxvmHzSXDKFX1gB-JJQDaGW_oJVo9bqk-_GaBthA,7582
35
- datapipelab-0.3.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
36
- datapipelab-0.3.6.dist-info/top_level.txt,sha256=HgeBjHvXorKzvNqU5BNPutoI771HtiqVit9_-0Zyrb4,12
37
- datapipelab-0.3.6.dist-info/RECORD,,
34
+ datapipelab-0.3.7.dist-info/METADATA,sha256=-5JXg6lz23dHiFEpXZvZUbGoOpTJOMgnyekWQCUCw7k,7582
35
+ datapipelab-0.3.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
36
+ datapipelab-0.3.7.dist-info/top_level.txt,sha256=HgeBjHvXorKzvNqU5BNPutoI771HtiqVit9_-0Zyrb4,12
37
+ datapipelab-0.3.7.dist-info/RECORD,,