maisaedu-poormans-dms 1.1.6__tar.gz → 1.1.8__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.6 → maisaedu-poormans-dms-1.1.8}/PKG-INFO +1 -1
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/redshift_migration/Models/Struct.py +4 -1
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/redshift_migration/Services/AdapterSourceTarget.py +19 -12
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/redshift_migration/Services/Struct.py +14 -11
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/redshift_migration/Writer/WriterCDC.py +8 -4
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms.egg-info/PKG-INFO +1 -1
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/setup.py +1 -1
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/LICENSE +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/__init__.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/postgres_migration/Contracts/MigratorInterface.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/postgres_migration/Contracts/MigratorRowInterface.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/postgres_migration/Contracts/MigratorRowReaderInterface.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/postgres_migration/Contracts/MigratorRowWriterInterface.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/postgres_migration/Contracts/MigratorTableInterface.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/postgres_migration/Contracts/__init__.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/postgres_migration/Migrator.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/postgres_migration/MigratorRow/MigratorRow.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/postgres_migration/MigratorRow/Reader.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/postgres_migration/MigratorRow/Writer.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/postgres_migration/MigratorRow/__init__.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/postgres_migration/MigratorTable.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/postgres_migration/__init__.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/redshift_migration/Connector.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/redshift_migration/Contracts/WriterInterface.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/redshift_migration/Contracts/__init__.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/redshift_migration/MigratorRedshift.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/redshift_migration/Models/ExtractionOperation.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/redshift_migration/Models/__init__.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/redshift_migration/Reader.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/redshift_migration/Services/ExtractionOperation.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/redshift_migration/Services/__init__.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/redshift_migration/Types.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/redshift_migration/Writer/GenericWriter.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/redshift_migration/Writer/WriterNonCDC.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/redshift_migration/Writer/__init__.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/redshift_migration/__init__.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms/sql_server_migration.py +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms.egg-info/SOURCES.txt +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms.egg-info/dependency_links.txt +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms.egg-info/requires.txt +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/maisaedu_poormans_dms.egg-info/top_level.txt +0 -0
- {maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/setup.cfg +0 -0
|
@@ -29,13 +29,16 @@ class Struct:
|
|
|
29
29
|
self.columns = []
|
|
30
30
|
self.columns_upsert = []
|
|
31
31
|
|
|
32
|
-
def add_column(
|
|
32
|
+
def add_column(
|
|
33
|
+
self, source_name, target_name, source_type, target_type, is_upsert, is_active
|
|
34
|
+
):
|
|
33
35
|
self.columns.append(
|
|
34
36
|
{
|
|
35
37
|
"source_name": source_name,
|
|
36
38
|
"target_name": target_name,
|
|
37
39
|
"source_type": source_type,
|
|
38
40
|
"target_type": target_type,
|
|
41
|
+
"is_active": is_active,
|
|
39
42
|
}
|
|
40
43
|
)
|
|
41
44
|
|
|
@@ -58,18 +58,25 @@ class AdapterSourceTarget:
|
|
|
58
58
|
def transform_data(self, df, target_save=REDSHIFT):
|
|
59
59
|
if target_save == REDSHIFT:
|
|
60
60
|
for c in self.struct.columns:
|
|
61
|
-
if c["
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
61
|
+
if c["is_active"] is False:
|
|
62
|
+
df[c["source_name"]] = ""
|
|
63
|
+
else:
|
|
64
|
+
if c["target_type"] == SUPER:
|
|
65
|
+
|
|
66
|
+
def decode_json(x):
|
|
67
|
+
try:
|
|
68
|
+
return json.loads(x)
|
|
69
|
+
except Exception as e:
|
|
70
|
+
return {
|
|
71
|
+
"redshift_error": "Field is too long to be saved"
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
df[c["source_name"]] = df[c["source_name"]].apply(json.dumps)
|
|
75
|
+
df[c["source_name"]] = df[c["source_name"]].str[
|
|
76
|
+
:MAX_VARCHAR_LENGTH
|
|
77
|
+
]
|
|
78
|
+
df[c["source_name"]] = df[c["source_name"]].apply(decode_json)
|
|
79
|
+
df[c["source_name"]] = df[c["source_name"]].apply(json.dumps)
|
|
73
80
|
elif target_save == S3:
|
|
74
81
|
for c in self.struct.columns:
|
|
75
82
|
if c["source_type"] == JSON or c["source_type"] == JSONB:
|
|
@@ -60,17 +60,19 @@ class Struct:
|
|
|
60
60
|
)
|
|
61
61
|
cursor.execute(
|
|
62
62
|
f"""
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
63
|
+
select
|
|
64
|
+
source_name,
|
|
65
|
+
target_name,
|
|
66
|
+
source_type,
|
|
67
|
+
target_type,
|
|
68
|
+
is_upsert,
|
|
69
|
+
is_active
|
|
70
|
+
from
|
|
71
|
+
dataeng.relations_columns_extraction
|
|
72
|
+
where
|
|
73
|
+
relation_id = {r[0]}
|
|
74
|
+
order by
|
|
75
|
+
id;
|
|
74
76
|
"""
|
|
75
77
|
)
|
|
76
78
|
columns = cursor.fetchall()
|
|
@@ -81,6 +83,7 @@ class Struct:
|
|
|
81
83
|
source_type=c[2],
|
|
82
84
|
target_type=c[3],
|
|
83
85
|
is_upsert=c[4],
|
|
86
|
+
is_active=c[5],
|
|
84
87
|
)
|
|
85
88
|
|
|
86
89
|
structs.append(struct_model)
|
|
@@ -107,9 +107,6 @@ class WriterCDC(GenericWriter, WriterInterface):
|
|
|
107
107
|
file_content = obj.get()["Body"].read()
|
|
108
108
|
|
|
109
109
|
df = pd.read_parquet(io.BytesIO(file_content))
|
|
110
|
-
print(len(df))
|
|
111
|
-
print("-----")
|
|
112
|
-
print(len(main_df))
|
|
113
110
|
|
|
114
111
|
main_df = pd.concat([main_df, df], ignore_index=True)
|
|
115
112
|
|
|
@@ -123,4 +120,11 @@ class WriterCDC(GenericWriter, WriterInterface):
|
|
|
123
120
|
|
|
124
121
|
except Exception as e:
|
|
125
122
|
self.delete_on_tmp_s3(bucket, path_file)
|
|
126
|
-
raise
|
|
123
|
+
raise Exception(
|
|
124
|
+
f"""
|
|
125
|
+
Error on save data on redshift
|
|
126
|
+
Cause of error: {e}
|
|
127
|
+
Operation url: {url}
|
|
128
|
+
You can download/check the file on s3, if the error was not direct in redshift
|
|
129
|
+
"""
|
|
130
|
+
)
|
|
File without changes
|
{maisaedu-poormans-dms-1.1.6 → maisaedu-poormans-dms-1.1.8}/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
|