maisaedu-poormans-dms 1.1.75__tar.gz → 1.1.77__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.
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/PKG-INFO +1 -1
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/redshift_migration/Reader.py +24 -13
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms.egg-info/PKG-INFO +1 -1
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/setup.py +1 -1
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/LICENSE +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/__init__.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/postgres_migration/Contracts/MigratorInterface.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/postgres_migration/Contracts/MigratorRowInterface.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/postgres_migration/Contracts/MigratorRowReaderInterface.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/postgres_migration/Contracts/MigratorRowWriterInterface.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/postgres_migration/Contracts/MigratorTableInterface.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/postgres_migration/Contracts/__init__.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/postgres_migration/Migrator.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/postgres_migration/MigratorRow/MigratorRow.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/postgres_migration/MigratorRow/Reader.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/postgres_migration/MigratorRow/Writer.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/postgres_migration/MigratorRow/__init__.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/postgres_migration/MigratorTable.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/postgres_migration/__init__.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/redshift_migration/Connector.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/redshift_migration/Contracts/WriterInterface.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/redshift_migration/Contracts/__init__.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/redshift_migration/Logger.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/redshift_migration/MigratorRedshift.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/redshift_migration/Models/ExtractionOperation.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/redshift_migration/Models/Struct.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/redshift_migration/Models/__init__.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/redshift_migration/Services/AdapterSourceTarget.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/redshift_migration/Services/ExtractionOperation.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/redshift_migration/Services/RelationExtraction.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/redshift_migration/Services/Struct.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/redshift_migration/Services/__init__.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/redshift_migration/Types.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/redshift_migration/Writer/GenericWriter.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/redshift_migration/Writer/WriterCDC.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/redshift_migration/Writer/WriterNonCDC.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/redshift_migration/Writer/__init__.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/redshift_migration/__init__.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/sql_server_migration.py +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms.egg-info/SOURCES.txt +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms.egg-info/dependency_links.txt +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms.egg-info/requires.txt +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms.egg-info/top_level.txt +0 -0
- {maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/setup.cfg +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import io
|
|
2
|
+
import threading
|
|
2
3
|
import pandas as pd
|
|
3
4
|
from datetime import datetime
|
|
4
5
|
from .Types import (
|
|
@@ -109,6 +110,20 @@ class Reader:
|
|
|
109
110
|
|
|
110
111
|
buffer.close()
|
|
111
112
|
|
|
113
|
+
def __process_chunk(self, chunk_df, path_file, path_file_tmp):
|
|
114
|
+
adapter = AdapterSourceTarget(self.struct)
|
|
115
|
+
chunk_df_s3 = chunk_df.copy()
|
|
116
|
+
|
|
117
|
+
chunk_df_s3 = adapter.transform_data(chunk_df_s3, target_save=S3)
|
|
118
|
+
|
|
119
|
+
self.save_on_bucket(chunk_df_s3, path_file)
|
|
120
|
+
|
|
121
|
+
chunk_df = adapter.convert_types(chunk_df)
|
|
122
|
+
chunk_df = adapter.transform_data(chunk_df)
|
|
123
|
+
chunk_df = adapter.equalize_number_columns(chunk_df)
|
|
124
|
+
|
|
125
|
+
self.save_on_bucket(chunk_df, path_file_tmp, format="csv")
|
|
126
|
+
|
|
112
127
|
def save_data_to_s3(self, load_option=None):
|
|
113
128
|
self.load_option = load_option
|
|
114
129
|
self.migrator_redshift_connector.connect_s3()
|
|
@@ -119,6 +134,7 @@ class Reader:
|
|
|
119
134
|
time = datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
|
|
120
135
|
idx = 1
|
|
121
136
|
path_file = None
|
|
137
|
+
threads = []
|
|
122
138
|
|
|
123
139
|
for chunk_df in pd.read_sql(
|
|
124
140
|
sql,
|
|
@@ -128,20 +144,15 @@ class Reader:
|
|
|
128
144
|
if len(chunk_df) != 0:
|
|
129
145
|
path_file = f"raw/prefect/{self.migrator_redshift_connector.env}/{self.struct.target_schema}/{self.struct.target_table}/{time}/{idx}.parquet"
|
|
130
146
|
path_file_tmp = f"raw/tmp/{self.migrator_redshift_connector.env}/{self.struct.target_schema}/{self.struct.target_table}/{time}/{idx}.csv"
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
self.save_on_bucket(chunk_df_s3, path_file)
|
|
138
|
-
|
|
139
|
-
chunk_df = adapter.convert_types(chunk_df)
|
|
140
|
-
chunk_df = adapter.transform_data(chunk_df)
|
|
141
|
-
chunk_df = adapter.equalize_number_columns(chunk_df)
|
|
142
|
-
|
|
143
|
-
self.save_on_bucket(chunk_df, path_file_tmp, format="csv")
|
|
147
|
+
|
|
148
|
+
thread = threading.Thread(target=self.__process_chunk, args=(chunk_df, path_file, path_file_tmp))
|
|
149
|
+
thread.start()
|
|
150
|
+
threads.append(thread)
|
|
151
|
+
|
|
144
152
|
idx = idx + 1
|
|
153
|
+
|
|
154
|
+
for thread in threads:
|
|
155
|
+
thread.join()
|
|
145
156
|
|
|
146
157
|
self.migrator_redshift_connector.close_source()
|
|
147
158
|
|
|
File without changes
|
{maisaedu-poormans-dms-1.1.75 → maisaedu-poormans-dms-1.1.77}/maisaedu_poormans_dms/__init__.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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|