maisaedu-poormans-dms 1.1.92__tar.gz → 1.1.93__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.
Files changed (58) hide show
  1. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/PKG-INFO +1 -1
  2. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_migration/Logger.py +6 -0
  3. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_migration/MigratorRedshift.py +59 -0
  4. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_migration/Reader/SQLServerReader.py +2 -2
  5. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms.egg-info/PKG-INFO +1 -1
  6. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/setup.py +1 -1
  7. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/LICENSE +0 -0
  8. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/__init__.py +0 -0
  9. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/postgres_migration/Contracts/MigratorInterface.py +0 -0
  10. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/postgres_migration/Contracts/MigratorRowInterface.py +0 -0
  11. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/postgres_migration/Contracts/MigratorRowReaderInterface.py +0 -0
  12. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/postgres_migration/Contracts/MigratorRowWriterInterface.py +0 -0
  13. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/postgres_migration/Contracts/MigratorTableInterface.py +0 -0
  14. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/postgres_migration/Contracts/__init__.py +0 -0
  15. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/postgres_migration/Migrator.py +0 -0
  16. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/postgres_migration/MigratorRow/MigratorRow.py +0 -0
  17. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/postgres_migration/MigratorRow/Reader.py +0 -0
  18. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/postgres_migration/MigratorRow/Writer.py +0 -0
  19. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/postgres_migration/MigratorRow/__init__.py +0 -0
  20. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/postgres_migration/MigratorTable.py +0 -0
  21. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/postgres_migration/__init__.py +0 -0
  22. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_dynamo_migration/Connector.py +0 -0
  23. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_dynamo_migration/DynamoReplicator.py +0 -0
  24. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_dynamo_migration/Writer/WriterCDC.py +0 -0
  25. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_dynamo_migration/Writer/WriterFull.py +0 -0
  26. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_dynamo_migration/Writer/__init__.py +0 -0
  27. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_dynamo_migration/__init__.py +0 -0
  28. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_dynamo_migration/models/Struct.py +0 -0
  29. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_dynamo_migration/models/__init__.py +0 -0
  30. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_dynamo_migration/services/Struct.py +0 -0
  31. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_dynamo_migration/services/__init__.py +0 -0
  32. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_migration/Connector.py +0 -0
  33. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_migration/Contracts/ReaderInterface.py +0 -0
  34. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_migration/Contracts/WriterInterface.py +0 -0
  35. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_migration/Contracts/__init__.py +0 -0
  36. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_migration/Models/ExtractionOperation.py +0 -0
  37. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_migration/Models/Struct.py +0 -0
  38. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_migration/Models/__init__.py +0 -0
  39. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_migration/Reader/GenericReader.py +0 -0
  40. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_migration/Reader/PostgresReader.py +0 -0
  41. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_migration/Reader/__init__.py +0 -0
  42. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_migration/Services/AdapterSourceTarget.py +0 -0
  43. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_migration/Services/ExtractionOperation.py +0 -0
  44. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_migration/Services/RelationExtraction.py +0 -0
  45. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_migration/Services/Struct.py +0 -0
  46. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_migration/Services/__init__.py +0 -0
  47. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_migration/Types.py +0 -0
  48. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_migration/Writer/GenericWriter.py +0 -0
  49. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_migration/Writer/WriterCDC.py +0 -0
  50. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_migration/Writer/WriterNonCDC.py +0 -0
  51. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_migration/Writer/__init__.py +0 -0
  52. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/redshift_migration/__init__.py +0 -0
  53. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms/sql_server_migration.py +0 -0
  54. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms.egg-info/SOURCES.txt +0 -0
  55. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms.egg-info/dependency_links.txt +0 -0
  56. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms.egg-info/requires.txt +0 -0
  57. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/maisaedu_poormans_dms.egg-info/top_level.txt +0 -0
  58. {maisaedu-poormans-dms-1.1.92 → maisaedu-poormans-dms-1.1.93}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: maisaedu-poormans-dms
3
- Version: 1.1.92
3
+ Version: 1.1.93
4
4
  Summary: A library for making database migration tasks, for +A Education
5
5
  Home-page: UNKNOWN
6
6
  Author: A+ Educação
@@ -14,3 +14,9 @@ class Logger:
14
14
  self.logger.info(message)
15
15
  else:
16
16
  print(message)
17
+
18
+ def error(self, message):
19
+ if self.logger is not None:
20
+ self.logger.error(message)
21
+ else:
22
+ print(message)
@@ -1,3 +1,6 @@
1
+ import os
2
+ import subprocess
3
+
1
4
  from .Connector import Connector
2
5
  from .Reader import factory as reader_factory
3
6
  from .Logger import Logger
@@ -12,6 +15,8 @@ from .Types import (
12
15
  PREFECT,
13
16
  PREFECT_DMS,
14
17
  SAVED_REDSHIFT,
18
+ SQLSERVER,
19
+ LOCAL
15
20
  )
16
21
 
17
22
 
@@ -116,6 +121,7 @@ class MigratorRedshift:
116
121
  )
117
122
 
118
123
  operation = self.migrator_redshift_reader.save_data_to_s3(load_option)
124
+ self.logger.info(f"Finished saving data to S3")
119
125
  if operation is not None:
120
126
  self.migrator_redshift_writer.save_to_redshift([operation])
121
127
  perfomed_operations = True
@@ -176,3 +182,56 @@ class MigratorRedshift:
176
182
  )
177
183
 
178
184
  return structs
185
+
186
+ def install_db_driver(self):
187
+ if self.migrator_redshift_connector.source_conn_type == SQLSERVER and self.env != LOCAL:
188
+ result = subprocess.run(['apt-get', 'update'], capture_output=True, text=True)
189
+ if result.returncode != 0:
190
+ self.logger.info(result.stderr)
191
+ else:
192
+ self.logger.info(result.stdout)
193
+ result = subprocess.run(['apt-get', 'install', 'curl', '-y'], capture_output=True, text=True)
194
+ if result.returncode != 0:
195
+ self.logger.info(result.stderr)
196
+ else:
197
+ self.logger.info(result.stdout)
198
+ result = subprocess.run(['apt-get', 'install', 'gnupg', '-y'], capture_output=True, text=True)
199
+ if result.returncode != 0:
200
+ self.logger.info(result.stderr)
201
+ else:
202
+ self.logger.info(result.stdout)
203
+ result = subprocess.run('curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg', shell=True, capture_output=True, text=True)
204
+ if result.returncode != 0:
205
+ self.logger.info(result.stderr)
206
+ else:
207
+ self.logger.info(result.stdout)
208
+ result = subprocess.run('curl https://packages.microsoft.com/config/debian/12/prod.list | tee /etc/apt/sources.list.d/mssql-release.list', shell=True, capture_output=True, text=True)
209
+ if result.returncode != 0:
210
+ self.logger.info(result.stderr)
211
+ else:
212
+ self.logger.info(result.stdout)
213
+ result = subprocess.run(['apt-get', 'update'], capture_output=True, text=True)
214
+ if result.returncode != 0:
215
+ self.logger.info(result.stderr)
216
+ else:
217
+ self.logger.info(result.stdout)
218
+
219
+ env = os.environ.copy()
220
+ env["ACCEPT_EULA"] = "Y"
221
+
222
+ result = subprocess.run(["apt-get", "install", "unixodbc", "unixodbc-dev", "msodbcsql17", "-y"], capture_output=True, text=True, env=env)
223
+ if result.returncode != 0:
224
+ self.logger.error(f"Error installing packages: {result.stderr}")
225
+ else:
226
+ self.logger.info(f"Installing unixodbc-dev and msodbcsql17: {result.stdout}")
227
+
228
+ result = subprocess.run(['apt-get', 'install', '-y', 'unixodbc-dev'], capture_output=True, text=True)
229
+ if result.returncode != 0:
230
+ self.logger.info(result.stderr)
231
+ else:
232
+ self.logger.info(result.stdout)
233
+ result = subprocess.run(['odbcinst', '-q', '-d', '-n', '"ODBC Driver 17 for SQL Server"'], capture_output=True, text=True)
234
+ if result.returncode != 0:
235
+ self.logger.info(result.stderr)
236
+ else:
237
+ self.logger.info(result.stdout)
@@ -70,8 +70,8 @@ class SQLServerReader(GenericReader, ReaderInterface):
70
70
 
71
71
  def get_limit_sql_statement(self):
72
72
  if self.migrator_redshift_connector.env == LOCAL:
73
- return f" TOP 100"
74
- # return f""
73
+ # return f" TOP 100"
74
+ return f""
75
75
  else:
76
76
  return f""
77
77
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: maisaedu-poormans-dms
3
- Version: 1.1.92
3
+ Version: 1.1.93
4
4
  Summary: A library for making database migration tasks, for +A Education
5
5
  Home-page: UNKNOWN
6
6
  Author: A+ Educação
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="maisaedu-poormans-dms",
5
- version="1.1.92",
5
+ version="1.1.93",
6
6
  description="A library for making database migration tasks, for +A Education",
7
7
  license="MIT License",
8
8
  author="A+ Educação",