DE-Lib 0.0.36.1__py3-none-any.whl → 0.0.36.2__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.
@@ -51,7 +51,17 @@ class OracleDDL:
51
51
  result = msg
52
52
  finally:
53
53
  return result
54
-
54
+
55
+ def truncate_table(self, table_name):
56
+ msg = result = None, None
57
+ try:
58
+ truncate_table = f"TRUNCATE TABLE {table_name}"
59
+ except Exception as error:
60
+ msg = error
61
+ result = msg
62
+ finally:
63
+ return result
64
+
55
65
  def prepare_data_for_insert(self, df):
56
66
  msg = result = None, None
57
67
  try:
@@ -65,11 +75,16 @@ class OracleDDL:
65
75
  finally:
66
76
  return result
67
77
 
68
- def create_table_and_insert_data(self, df, table_name, conn):
78
+ def create_table_and_insert_data(self, df, table_name, conn, truncate: True):
69
79
  msg = result = None, None
70
80
  try:
71
81
  cur = conn.cursor()
72
82
  try:
83
+ if truncate:
84
+ truncate_sql = self.truncate_table(table_name)
85
+ cur.execute(truncate_sql)
86
+ self.Table_was_truncated = truncate
87
+
73
88
  create_sql = self.generate_create_table_sql(table_name, df)
74
89
  cur.execute(create_sql)
75
90
  except:
@@ -87,4 +102,12 @@ class OracleDDL:
87
102
  msg = error
88
103
  result = msg
89
104
  finally:
90
- return result
105
+ return result
106
+
107
+ @property
108
+ def Table_was_truncated(self):
109
+ return self.__Table_was_truncated
110
+
111
+ @Table_was_truncated.setter
112
+ def Table_was_truncated(self, value):
113
+ self.__Table_was_truncated = value
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: DE_Lib
3
- Version: 0.0.36.1
3
+ Version: 0.0.36.2
4
4
  Summary: Biblioteca de funcionalidades
5
5
  Home-page: https://github.com/DE-DATAx/DAX_DB.git
6
6
  Author: Almir J Gomes
@@ -8,7 +8,7 @@ DE_Lib/DataBase/Metadata.py,sha256=j0iJm26Sf0QvsYpN61hfwkllyW2EOA2XoFnSzEo9plE,3
8
8
  DE_Lib/DataBase/MsSql.py,sha256=tVx7fdFkw1ZNhfjqw-KuyHtT-hqJ9ZNCR2iU_ogSUVk,1640
9
9
  DE_Lib/DataBase/MySql.py,sha256=SWLJMaB30EBqaz32xwMBbc3lnemDPpF2kkkf5umlL3k,2534
10
10
  DE_Lib/DataBase/Oracle.py,sha256=n9ub6J6zNX4z62pUWjut3PGxXzLDZQ9jVhZ6eGzFPEw,9704
11
- DE_Lib/DataBase/OracleDDL.py,sha256=5uGtaQ_r-GSfO6Vk9YRBs-7tq_myavxHm9ee7-tG1tY,3074
11
+ DE_Lib/DataBase/OracleDDL.py,sha256=stvpVcQwOpZUmQXrQTH1IN3keYj_tQFjzKcKDil2_C0,3793
12
12
  DE_Lib/DataBase/Postgres.py,sha256=lMb6sFGvjjuuq4D4k7zzEo7-NtyrC79VITeKQfoDO6U,1667
13
13
  DE_Lib/DataBase/RedShift.py,sha256=ewPi8hxEhfuekBpMl-P1LWgSGfbqPKRpXfjtduCwOKc,1736
14
14
  DE_Lib/DataBase/SQCipher.py,sha256=Bw7nq4tQdhM7ux0INF9PUymsIIjBEwMKcA1Un8orCE8,1625
@@ -42,8 +42,8 @@ DE_Lib/Utils/Cipher/Gcm.py,sha256=fOuCVOyd4sGv389E91yqomujKTtFZu6CyhySrmQKVfY,23
42
42
  DE_Lib/Utils/Cipher/Pbkdf2.py,sha256=hRkgf0Fo5hV1gLbWlFGFzhYYUjPEqgpB2R-pPw7N2F8,1210
43
43
  DE_Lib/Utils/Cipher/Rsa.py,sha256=MYG1YsGuq-Q-MoF6pmeMD0TyxMTwt6tuUaLvXcmzQ2k,4126
44
44
  DE_Lib/Utils/Cipher/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
45
- de_lib-0.0.36.1.dist-info/licenses/LICENCE,sha256=Qv2ilebwoUtMJnRsZwRy729xS5JZQzLauJ0tQzkAkTA,1088
46
- de_lib-0.0.36.1.dist-info/METADATA,sha256=S0gd_5_jostVHyEYtv5aKlp0whjM9x9g8IApFXtBw9k,2289
47
- de_lib-0.0.36.1.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
48
- de_lib-0.0.36.1.dist-info/top_level.txt,sha256=yI9fdM_jkhCz_sykPZQbfeUbQ1FRMt-xjv9fJ6YZVLE,7
49
- de_lib-0.0.36.1.dist-info/RECORD,,
45
+ de_lib-0.0.36.2.dist-info/licenses/LICENCE,sha256=Qv2ilebwoUtMJnRsZwRy729xS5JZQzLauJ0tQzkAkTA,1088
46
+ de_lib-0.0.36.2.dist-info/METADATA,sha256=gjvzXNpsiqzVsh_8NWb6kyUcbuRpVTin26-Npw2m82g,2289
47
+ de_lib-0.0.36.2.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
48
+ de_lib-0.0.36.2.dist-info/top_level.txt,sha256=yI9fdM_jkhCz_sykPZQbfeUbQ1FRMt-xjv9fJ6YZVLE,7
49
+ de_lib-0.0.36.2.dist-info/RECORD,,