mkpipe-loader-postgres 0.1.34__tar.gz → 0.3.0__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.
- mkpipe_loader_postgres-0.3.0/PKG-INFO +50 -0
- mkpipe_loader_postgres-0.3.0/README.md +26 -0
- mkpipe_loader_postgres-0.3.0/mkpipe_loader_postgres/__init__.py +15 -0
- mkpipe_loader_postgres-0.3.0/mkpipe_loader_postgres.egg-info/PKG-INFO +50 -0
- {mkpipe_loader_postgres-0.1.34 → mkpipe_loader_postgres-0.3.0}/setup.py +1 -1
- mkpipe_loader_postgres-0.1.34/PKG-INFO +0 -73
- mkpipe_loader_postgres-0.1.34/README.md +0 -59
- mkpipe_loader_postgres-0.1.34/mkpipe_loader_postgres/__init__.py +0 -169
- mkpipe_loader_postgres-0.1.34/mkpipe_loader_postgres.egg-info/PKG-INFO +0 -73
- {mkpipe_loader_postgres-0.1.34 → mkpipe_loader_postgres-0.3.0}/LICENSE +0 -0
- {mkpipe_loader_postgres-0.1.34 → mkpipe_loader_postgres-0.3.0}/MANIFEST.in +0 -0
- {mkpipe_loader_postgres-0.1.34 → mkpipe_loader_postgres-0.3.0}/mkpipe_loader_postgres/jar_paths.py +0 -0
- {mkpipe_loader_postgres-0.1.34 → mkpipe_loader_postgres-0.3.0}/mkpipe_loader_postgres/jars/org.postgresql_postgresql-42.7.4.jar +0 -0
- {mkpipe_loader_postgres-0.1.34 → mkpipe_loader_postgres-0.3.0}/mkpipe_loader_postgres.egg-info/SOURCES.txt +0 -0
- {mkpipe_loader_postgres-0.1.34 → mkpipe_loader_postgres-0.3.0}/mkpipe_loader_postgres.egg-info/dependency_links.txt +0 -0
- {mkpipe_loader_postgres-0.1.34 → mkpipe_loader_postgres-0.3.0}/mkpipe_loader_postgres.egg-info/entry_points.txt +0 -0
- {mkpipe_loader_postgres-0.1.34 → mkpipe_loader_postgres-0.3.0}/mkpipe_loader_postgres.egg-info/requires.txt +0 -0
- {mkpipe_loader_postgres-0.1.34 → mkpipe_loader_postgres-0.3.0}/mkpipe_loader_postgres.egg-info/top_level.txt +0 -0
- {mkpipe_loader_postgres-0.1.34 → mkpipe_loader_postgres-0.3.0}/setup.cfg +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mkpipe-loader-postgres
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: PostgreSQL loader for mkpipe.
|
|
5
|
+
Author: Metin Karakus
|
|
6
|
+
Author-email: metin_karakus@yahoo.com
|
|
7
|
+
License: Apache License 2.0
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
+
Requires-Python: >=3.8
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: mkpipe
|
|
14
|
+
Dynamic: author
|
|
15
|
+
Dynamic: author-email
|
|
16
|
+
Dynamic: classifier
|
|
17
|
+
Dynamic: description
|
|
18
|
+
Dynamic: description-content-type
|
|
19
|
+
Dynamic: license
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
Dynamic: requires-dist
|
|
22
|
+
Dynamic: requires-python
|
|
23
|
+
Dynamic: summary
|
|
24
|
+
|
|
25
|
+
# MkPipe
|
|
26
|
+
|
|
27
|
+
**MkPipe** is a modular, open-source ETL (Extract, Transform, Load) tool that allows you to integrate various data sources and sinks easily. It is designed to be extensible with a plugin-based architecture that supports extractors, transformers, and loaders.
|
|
28
|
+
|
|
29
|
+
## Documentation
|
|
30
|
+
|
|
31
|
+
For more detailed documentation, please visit the [GitHub repository](https://github.com/mkpipe-etl/mkpipe).
|
|
32
|
+
|
|
33
|
+
## License
|
|
34
|
+
|
|
35
|
+
This project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE) file for details.
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## mkpipe_project.yaml Variables
|
|
39
|
+
```yaml
|
|
40
|
+
...
|
|
41
|
+
connections:
|
|
42
|
+
source:
|
|
43
|
+
host: 'XXX'
|
|
44
|
+
port: 'XXX'
|
|
45
|
+
database: 'XXX'
|
|
46
|
+
schema: 'XXX'
|
|
47
|
+
user: 'XXX'
|
|
48
|
+
password: 'XXX'
|
|
49
|
+
...
|
|
50
|
+
```
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# MkPipe
|
|
2
|
+
|
|
3
|
+
**MkPipe** is a modular, open-source ETL (Extract, Transform, Load) tool that allows you to integrate various data sources and sinks easily. It is designed to be extensible with a plugin-based architecture that supports extractors, transformers, and loaders.
|
|
4
|
+
|
|
5
|
+
## Documentation
|
|
6
|
+
|
|
7
|
+
For more detailed documentation, please visit the [GitHub repository](https://github.com/mkpipe-etl/mkpipe).
|
|
8
|
+
|
|
9
|
+
## License
|
|
10
|
+
|
|
11
|
+
This project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE) file for details.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## mkpipe_project.yaml Variables
|
|
15
|
+
```yaml
|
|
16
|
+
...
|
|
17
|
+
connections:
|
|
18
|
+
source:
|
|
19
|
+
host: 'XXX'
|
|
20
|
+
port: 'XXX'
|
|
21
|
+
database: 'XXX'
|
|
22
|
+
schema: 'XXX'
|
|
23
|
+
user: 'XXX'
|
|
24
|
+
password: 'XXX'
|
|
25
|
+
...
|
|
26
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from mkpipe.spark import JdbcLoader
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class PostgresLoader(JdbcLoader, variant='postgresql'):
|
|
5
|
+
driver_name = 'postgresql'
|
|
6
|
+
driver_jdbc = 'org.postgresql.Driver'
|
|
7
|
+
|
|
8
|
+
def build_jdbc_url(self):
|
|
9
|
+
url = (
|
|
10
|
+
f'jdbc:{self.driver_name}://{self.host}:{self.port}/{self.database}'
|
|
11
|
+
f'?user={self.username}&password={self.password}'
|
|
12
|
+
)
|
|
13
|
+
if self.schema:
|
|
14
|
+
url += f'¤tSchema={self.schema}'
|
|
15
|
+
return url
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mkpipe-loader-postgres
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: PostgreSQL loader for mkpipe.
|
|
5
|
+
Author: Metin Karakus
|
|
6
|
+
Author-email: metin_karakus@yahoo.com
|
|
7
|
+
License: Apache License 2.0
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
+
Requires-Python: >=3.8
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: mkpipe
|
|
14
|
+
Dynamic: author
|
|
15
|
+
Dynamic: author-email
|
|
16
|
+
Dynamic: classifier
|
|
17
|
+
Dynamic: description
|
|
18
|
+
Dynamic: description-content-type
|
|
19
|
+
Dynamic: license
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
Dynamic: requires-dist
|
|
22
|
+
Dynamic: requires-python
|
|
23
|
+
Dynamic: summary
|
|
24
|
+
|
|
25
|
+
# MkPipe
|
|
26
|
+
|
|
27
|
+
**MkPipe** is a modular, open-source ETL (Extract, Transform, Load) tool that allows you to integrate various data sources and sinks easily. It is designed to be extensible with a plugin-based architecture that supports extractors, transformers, and loaders.
|
|
28
|
+
|
|
29
|
+
## Documentation
|
|
30
|
+
|
|
31
|
+
For more detailed documentation, please visit the [GitHub repository](https://github.com/mkpipe-etl/mkpipe).
|
|
32
|
+
|
|
33
|
+
## License
|
|
34
|
+
|
|
35
|
+
This project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE) file for details.
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## mkpipe_project.yaml Variables
|
|
39
|
+
```yaml
|
|
40
|
+
...
|
|
41
|
+
connections:
|
|
42
|
+
source:
|
|
43
|
+
host: 'XXX'
|
|
44
|
+
port: 'XXX'
|
|
45
|
+
database: 'XXX'
|
|
46
|
+
schema: 'XXX'
|
|
47
|
+
user: 'XXX'
|
|
48
|
+
password: 'XXX'
|
|
49
|
+
...
|
|
50
|
+
```
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name='mkpipe-loader-postgres',
|
|
5
|
-
version='0.
|
|
5
|
+
version='0.3.0',
|
|
6
6
|
license='Apache License 2.0',
|
|
7
7
|
packages=find_packages(exclude=['tests', 'scripts', 'deploy', 'install_jars.py']),
|
|
8
8
|
install_requires=['mkpipe'],
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: mkpipe-loader-postgres
|
|
3
|
-
Version: 0.1.34
|
|
4
|
-
Summary: PostgreSQL loader for mkpipe.
|
|
5
|
-
Author: Metin Karakus
|
|
6
|
-
Author-email: metin_karakus@yahoo.com
|
|
7
|
-
License: Apache License 2.0
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
-
Requires-Python: >=3.8
|
|
11
|
-
Description-Content-Type: text/markdown
|
|
12
|
-
License-File: LICENSE
|
|
13
|
-
Requires-Dist: mkpipe
|
|
14
|
-
|
|
15
|
-
# MkPipe
|
|
16
|
-
|
|
17
|
-
**MkPipe** is a modular, open-source ETL (Extract, Transform, Load) tool that allows you to integrate various data sources and sinks easily. It is designed to be extensible with a plugin-based architecture that supports extractors, transformers, and loaders.
|
|
18
|
-
|
|
19
|
-
## Features
|
|
20
|
-
|
|
21
|
-
- Extract data from multiple sources (e.g., PostgreSQL, MongoDB).
|
|
22
|
-
- Transform data using custom Python logic and Apache Spark.
|
|
23
|
-
- Load data into various sinks (e.g., ClickHouse, PostgreSQL, Parquet).
|
|
24
|
-
- Plugin-based architecture that supports future extensions.
|
|
25
|
-
- Cloud-native architecture, can be deployed on Kubernetes and other environments.
|
|
26
|
-
|
|
27
|
-
## Installation
|
|
28
|
-
|
|
29
|
-
You can install the core package and extractors using pip:
|
|
30
|
-
|
|
31
|
-
### Install the core package:
|
|
32
|
-
```bash
|
|
33
|
-
pip install mkpipe
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
### Install the Postgres extractor:
|
|
37
|
-
```bash
|
|
38
|
-
pip install mkpipe-loader-postgres
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### Install additional extractors or loaders as needed:
|
|
42
|
-
You can find or contribute new extractors and loaders in the future.
|
|
43
|
-
|
|
44
|
-
## Usage
|
|
45
|
-
|
|
46
|
-
To run the ETL process, use the following command:
|
|
47
|
-
|
|
48
|
-
```py
|
|
49
|
-
from mkpipe_core.plugins.registry import EXTRACTORS
|
|
50
|
-
|
|
51
|
-
def test_postgres_extractor():
|
|
52
|
-
postgres_extractor = EXTRACTORS.get("postgresql")
|
|
53
|
-
if not postgres_extractor:
|
|
54
|
-
print("Postgres extractor not found!")
|
|
55
|
-
return
|
|
56
|
-
instance = postgres_extractor()
|
|
57
|
-
instance.extract()
|
|
58
|
-
|
|
59
|
-
if __name__ == "__main__":
|
|
60
|
-
test_postgres_extractor()
|
|
61
|
-
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
Where `elt.yaml` is your configuration file that specifies the extractors, transformers, and loaders.
|
|
65
|
-
|
|
66
|
-
## Documentation
|
|
67
|
-
|
|
68
|
-
For more detailed documentation, please visit the [GitHub repository](https://github.com/mkpipe-etl/mkpipe).
|
|
69
|
-
|
|
70
|
-
## License
|
|
71
|
-
|
|
72
|
-
This project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE) file for details.
|
|
73
|
-
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# MkPipe
|
|
2
|
-
|
|
3
|
-
**MkPipe** is a modular, open-source ETL (Extract, Transform, Load) tool that allows you to integrate various data sources and sinks easily. It is designed to be extensible with a plugin-based architecture that supports extractors, transformers, and loaders.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- Extract data from multiple sources (e.g., PostgreSQL, MongoDB).
|
|
8
|
-
- Transform data using custom Python logic and Apache Spark.
|
|
9
|
-
- Load data into various sinks (e.g., ClickHouse, PostgreSQL, Parquet).
|
|
10
|
-
- Plugin-based architecture that supports future extensions.
|
|
11
|
-
- Cloud-native architecture, can be deployed on Kubernetes and other environments.
|
|
12
|
-
|
|
13
|
-
## Installation
|
|
14
|
-
|
|
15
|
-
You can install the core package and extractors using pip:
|
|
16
|
-
|
|
17
|
-
### Install the core package:
|
|
18
|
-
```bash
|
|
19
|
-
pip install mkpipe
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
### Install the Postgres extractor:
|
|
23
|
-
```bash
|
|
24
|
-
pip install mkpipe-loader-postgres
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### Install additional extractors or loaders as needed:
|
|
28
|
-
You can find or contribute new extractors and loaders in the future.
|
|
29
|
-
|
|
30
|
-
## Usage
|
|
31
|
-
|
|
32
|
-
To run the ETL process, use the following command:
|
|
33
|
-
|
|
34
|
-
```py
|
|
35
|
-
from mkpipe_core.plugins.registry import EXTRACTORS
|
|
36
|
-
|
|
37
|
-
def test_postgres_extractor():
|
|
38
|
-
postgres_extractor = EXTRACTORS.get("postgresql")
|
|
39
|
-
if not postgres_extractor:
|
|
40
|
-
print("Postgres extractor not found!")
|
|
41
|
-
return
|
|
42
|
-
instance = postgres_extractor()
|
|
43
|
-
instance.extract()
|
|
44
|
-
|
|
45
|
-
if __name__ == "__main__":
|
|
46
|
-
test_postgres_extractor()
|
|
47
|
-
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
Where `elt.yaml` is your configuration file that specifies the extractors, transformers, and loaders.
|
|
51
|
-
|
|
52
|
-
## Documentation
|
|
53
|
-
|
|
54
|
-
For more detailed documentation, please visit the [GitHub repository](https://github.com/mkpipe-etl/mkpipe).
|
|
55
|
-
|
|
56
|
-
## License
|
|
57
|
-
|
|
58
|
-
This project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE) file for details.
|
|
59
|
-
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import time
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
from urllib.parse import quote_plus
|
|
4
|
-
from pyspark.sql import functions as F
|
|
5
|
-
from pyspark.sql.types import TimestampType
|
|
6
|
-
from mkpipe.config import load_config
|
|
7
|
-
from mkpipe.functions_db import get_db_connector
|
|
8
|
-
from mkpipe.functions_spark import remove_partitioned_parquet, get_parser
|
|
9
|
-
from mkpipe.utils import log_container, Logger
|
|
10
|
-
from mkpipe.utils.base_class import PipeSettings
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class PostgresLoader:
|
|
14
|
-
def __init__(self, config, settings):
|
|
15
|
-
if isinstance(settings, dict):
|
|
16
|
-
self.settings = PipeSettings(**settings)
|
|
17
|
-
else:
|
|
18
|
-
self.settings = settings
|
|
19
|
-
self.connection_params = config['connection_params']
|
|
20
|
-
self.host = self.connection_params['host']
|
|
21
|
-
self.port = self.connection_params['port']
|
|
22
|
-
self.username = self.connection_params['user']
|
|
23
|
-
self.password = quote_plus(str(self.connection_params['password']))
|
|
24
|
-
self.database = self.connection_params['database']
|
|
25
|
-
self.schema = self.connection_params['schema']
|
|
26
|
-
|
|
27
|
-
self.driver_name = 'postgresql'
|
|
28
|
-
self.driver_jdbc = 'org.postgresql.Driver'
|
|
29
|
-
|
|
30
|
-
self.settings.driver_name = self.driver_name
|
|
31
|
-
self.jdbc_url = f'jdbc:{self.driver_name}://{self.host}:{self.port}/{self.database}?user={self.username}&password={self.password}¤tSchema={self.schema}'
|
|
32
|
-
|
|
33
|
-
config = load_config()
|
|
34
|
-
connection_params = config['settings']['backend']
|
|
35
|
-
db_type = connection_params['database_type']
|
|
36
|
-
self.backend = get_db_connector(db_type)(connection_params)
|
|
37
|
-
|
|
38
|
-
def add_custom_columns(self, df, elt_start_time):
|
|
39
|
-
if 'etl_time' in df.columns:
|
|
40
|
-
df = df.drop('etl_time')
|
|
41
|
-
|
|
42
|
-
df = df.withColumn('etl_time', F.lit(elt_start_time))
|
|
43
|
-
return df
|
|
44
|
-
|
|
45
|
-
@log_container(__file__)
|
|
46
|
-
def load(self, data, elt_start_time):
|
|
47
|
-
try:
|
|
48
|
-
logger = Logger(__file__)
|
|
49
|
-
start_time = time.time()
|
|
50
|
-
name = data['table_name']
|
|
51
|
-
|
|
52
|
-
write_mode = data.get('write_mode', None)
|
|
53
|
-
file_type = data.get('file_type', None)
|
|
54
|
-
last_point_value = data.get('last_point_value', None)
|
|
55
|
-
iterate_column_type = data.get('iterate_column_type', None)
|
|
56
|
-
replication_method = data.get('replication_method', 'full')
|
|
57
|
-
batchsize = data.get('fetchsize', 100_000)
|
|
58
|
-
pass_on_error = data.get('pass_on_error', None)
|
|
59
|
-
|
|
60
|
-
if not file_type:
|
|
61
|
-
'means that the data fetched before no new data'
|
|
62
|
-
self.backend.manifest_table_update(
|
|
63
|
-
name=name,
|
|
64
|
-
value=None, # Last point remains unchanged
|
|
65
|
-
value_type=None, # Type remains unchanged
|
|
66
|
-
status='completed', # ('completed', 'failed', 'extracting', 'loading')
|
|
67
|
-
replication_method=replication_method, # ('incremental', 'full')
|
|
68
|
-
error_message='',
|
|
69
|
-
)
|
|
70
|
-
return
|
|
71
|
-
|
|
72
|
-
self.backend.manifest_table_update(
|
|
73
|
-
name=name,
|
|
74
|
-
value=None, # Last point remains unchanged
|
|
75
|
-
value_type=None, # Type remains unchanged
|
|
76
|
-
status='loading', # ('completed', 'failed', 'extracting', 'loading')
|
|
77
|
-
replication_method=replication_method, # ('incremental', 'full')
|
|
78
|
-
error_message='',
|
|
79
|
-
)
|
|
80
|
-
|
|
81
|
-
df = get_parser(file_type)(data, self.settings)
|
|
82
|
-
df = self.add_custom_columns(df, elt_start_time)
|
|
83
|
-
message = dict(
|
|
84
|
-
table_name=name,
|
|
85
|
-
status='loading',
|
|
86
|
-
total_partition_count=df.rdd.getNumPartitions(),
|
|
87
|
-
)
|
|
88
|
-
logger.info(message)
|
|
89
|
-
|
|
90
|
-
(
|
|
91
|
-
df.write.format('jdbc')
|
|
92
|
-
.mode(
|
|
93
|
-
write_mode
|
|
94
|
-
) # Use write_mode for the first iteration, 'append' for others
|
|
95
|
-
.option('url', self.jdbc_url)
|
|
96
|
-
.option('dbtable', name)
|
|
97
|
-
.option('driver', self.driver_jdbc)
|
|
98
|
-
.option('batchsize', batchsize)
|
|
99
|
-
.save()
|
|
100
|
-
)
|
|
101
|
-
|
|
102
|
-
"""
|
|
103
|
-
for index in range(df.rdd.getNumPartitions()):
|
|
104
|
-
# Filter the DataFrame by partition index
|
|
105
|
-
partition_df = df.filter(F.spark_partition_id() == index)
|
|
106
|
-
|
|
107
|
-
# Determine the correct write mode (use write_mode for the first iteration, 'append' for others)
|
|
108
|
-
current_write_mode = write_mode if index == 0 else 'append'
|
|
109
|
-
|
|
110
|
-
# Write the partitioned DataFrame to PostgreSQL
|
|
111
|
-
(
|
|
112
|
-
partition_df.write.format('jdbc')
|
|
113
|
-
.mode(
|
|
114
|
-
current_write_mode
|
|
115
|
-
) # Use write_mode for the first iteration, 'append' for others
|
|
116
|
-
.option('url', self.jdbc_url)
|
|
117
|
-
.option('dbtable', name)
|
|
118
|
-
.option('driver', self.driver_jdbc)
|
|
119
|
-
.option('batchsize', batchsize)
|
|
120
|
-
.save()
|
|
121
|
-
)
|
|
122
|
-
"""
|
|
123
|
-
|
|
124
|
-
# Update last point in the mkpipe_manifest table if applicable
|
|
125
|
-
self.backend.manifest_table_update(
|
|
126
|
-
name=name,
|
|
127
|
-
value=last_point_value,
|
|
128
|
-
value_type=iterate_column_type,
|
|
129
|
-
status='completed',
|
|
130
|
-
replication_method=replication_method,
|
|
131
|
-
error_message='',
|
|
132
|
-
)
|
|
133
|
-
|
|
134
|
-
message = dict(table_name=name, status=write_mode)
|
|
135
|
-
logger.info(message)
|
|
136
|
-
|
|
137
|
-
# remove the parquet to reduce the storage
|
|
138
|
-
remove_partitioned_parquet(data['path'])
|
|
139
|
-
|
|
140
|
-
run_time = time.time() - start_time
|
|
141
|
-
message = dict(table_name=name, status='success', run_time=run_time)
|
|
142
|
-
logger.info(message)
|
|
143
|
-
|
|
144
|
-
except Exception as e:
|
|
145
|
-
# Log the error message and update the mkpipe_manifest with the error details
|
|
146
|
-
message = dict(
|
|
147
|
-
table_name=name,
|
|
148
|
-
status='failed',
|
|
149
|
-
type='loading',
|
|
150
|
-
error_message=str(e),
|
|
151
|
-
etl_start_time=str(elt_start_time),
|
|
152
|
-
)
|
|
153
|
-
|
|
154
|
-
self.backend.manifest_table_update(
|
|
155
|
-
name=name,
|
|
156
|
-
value=None, # Last point remains unchanged
|
|
157
|
-
value_type=None, # Type remains unchanged
|
|
158
|
-
status='failed',
|
|
159
|
-
replication_method=replication_method,
|
|
160
|
-
error_message=str(e),
|
|
161
|
-
)
|
|
162
|
-
|
|
163
|
-
if pass_on_error:
|
|
164
|
-
logger.warning(message)
|
|
165
|
-
return
|
|
166
|
-
else:
|
|
167
|
-
logger.error(message)
|
|
168
|
-
raise Exception(message) from e
|
|
169
|
-
return
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: mkpipe-loader-postgres
|
|
3
|
-
Version: 0.1.34
|
|
4
|
-
Summary: PostgreSQL loader for mkpipe.
|
|
5
|
-
Author: Metin Karakus
|
|
6
|
-
Author-email: metin_karakus@yahoo.com
|
|
7
|
-
License: Apache License 2.0
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
-
Requires-Python: >=3.8
|
|
11
|
-
Description-Content-Type: text/markdown
|
|
12
|
-
License-File: LICENSE
|
|
13
|
-
Requires-Dist: mkpipe
|
|
14
|
-
|
|
15
|
-
# MkPipe
|
|
16
|
-
|
|
17
|
-
**MkPipe** is a modular, open-source ETL (Extract, Transform, Load) tool that allows you to integrate various data sources and sinks easily. It is designed to be extensible with a plugin-based architecture that supports extractors, transformers, and loaders.
|
|
18
|
-
|
|
19
|
-
## Features
|
|
20
|
-
|
|
21
|
-
- Extract data from multiple sources (e.g., PostgreSQL, MongoDB).
|
|
22
|
-
- Transform data using custom Python logic and Apache Spark.
|
|
23
|
-
- Load data into various sinks (e.g., ClickHouse, PostgreSQL, Parquet).
|
|
24
|
-
- Plugin-based architecture that supports future extensions.
|
|
25
|
-
- Cloud-native architecture, can be deployed on Kubernetes and other environments.
|
|
26
|
-
|
|
27
|
-
## Installation
|
|
28
|
-
|
|
29
|
-
You can install the core package and extractors using pip:
|
|
30
|
-
|
|
31
|
-
### Install the core package:
|
|
32
|
-
```bash
|
|
33
|
-
pip install mkpipe
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
### Install the Postgres extractor:
|
|
37
|
-
```bash
|
|
38
|
-
pip install mkpipe-loader-postgres
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### Install additional extractors or loaders as needed:
|
|
42
|
-
You can find or contribute new extractors and loaders in the future.
|
|
43
|
-
|
|
44
|
-
## Usage
|
|
45
|
-
|
|
46
|
-
To run the ETL process, use the following command:
|
|
47
|
-
|
|
48
|
-
```py
|
|
49
|
-
from mkpipe_core.plugins.registry import EXTRACTORS
|
|
50
|
-
|
|
51
|
-
def test_postgres_extractor():
|
|
52
|
-
postgres_extractor = EXTRACTORS.get("postgresql")
|
|
53
|
-
if not postgres_extractor:
|
|
54
|
-
print("Postgres extractor not found!")
|
|
55
|
-
return
|
|
56
|
-
instance = postgres_extractor()
|
|
57
|
-
instance.extract()
|
|
58
|
-
|
|
59
|
-
if __name__ == "__main__":
|
|
60
|
-
test_postgres_extractor()
|
|
61
|
-
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
Where `elt.yaml` is your configuration file that specifies the extractors, transformers, and loaders.
|
|
65
|
-
|
|
66
|
-
## Documentation
|
|
67
|
-
|
|
68
|
-
For more detailed documentation, please visit the [GitHub repository](https://github.com/mkpipe-etl/mkpipe).
|
|
69
|
-
|
|
70
|
-
## License
|
|
71
|
-
|
|
72
|
-
This project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE) file for details.
|
|
73
|
-
|
|
File without changes
|
|
File without changes
|
{mkpipe_loader_postgres-0.1.34 → mkpipe_loader_postgres-0.3.0}/mkpipe_loader_postgres/jar_paths.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|