wcp-library 1.0.6__tar.gz → 1.0.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.
- {wcp_library-1.0.6 → wcp_library-1.0.8}/PKG-INFO +1 -1
- {wcp_library-1.0.6 → wcp_library-1.0.8}/pyproject.toml +1 -1
- {wcp_library-1.0.6 → wcp_library-1.0.8}/wcp_library/async_sql/oracle.py +30 -36
- {wcp_library-1.0.6 → wcp_library-1.0.8}/README.md +0 -0
- {wcp_library-1.0.6 → wcp_library-1.0.8}/wcp_library/__init__.py +0 -0
- {wcp_library-1.0.6 → wcp_library-1.0.8}/wcp_library/async_credentials/__init__.py +0 -0
- {wcp_library-1.0.6 → wcp_library-1.0.8}/wcp_library/async_credentials/api.py +0 -0
- {wcp_library-1.0.6 → wcp_library-1.0.8}/wcp_library/async_credentials/oracle.py +0 -0
- {wcp_library-1.0.6 → wcp_library-1.0.8}/wcp_library/async_credentials/postgres.py +0 -0
- {wcp_library-1.0.6 → wcp_library-1.0.8}/wcp_library/async_sql/__init__.py +0 -0
- {wcp_library-1.0.6 → wcp_library-1.0.8}/wcp_library/async_sql/postgres.py +0 -0
- {wcp_library-1.0.6 → wcp_library-1.0.8}/wcp_library/credentials/__init__.py +0 -0
- {wcp_library-1.0.6 → wcp_library-1.0.8}/wcp_library/credentials/api.py +0 -0
- {wcp_library-1.0.6 → wcp_library-1.0.8}/wcp_library/credentials/oracle.py +0 -0
- {wcp_library-1.0.6 → wcp_library-1.0.8}/wcp_library/credentials/postgres.py +0 -0
- {wcp_library-1.0.6 → wcp_library-1.0.8}/wcp_library/emailing.py +0 -0
- {wcp_library-1.0.6 → wcp_library-1.0.8}/wcp_library/informatica.py +0 -0
- {wcp_library-1.0.6 → wcp_library-1.0.8}/wcp_library/logging.py +0 -0
- {wcp_library-1.0.6 → wcp_library-1.0.8}/wcp_library/sql/__init__.py +0 -0
- {wcp_library-1.0.6 → wcp_library-1.0.8}/wcp_library/sql/oracle.py +0 -0
- {wcp_library-1.0.6 → wcp_library-1.0.8}/wcp_library/sql/postgres.py +0 -0
@@ -32,8 +32,7 @@ async def connect_warehouse(username: str, password: str, hostname: str, port: i
|
|
32
32
|
dsn=dsn,
|
33
33
|
min=min_connections,
|
34
34
|
max=max_connections,
|
35
|
-
increment=1
|
36
|
-
encoding="UTF-8"
|
35
|
+
increment=1
|
37
36
|
)
|
38
37
|
return session_pool
|
39
38
|
|
@@ -113,11 +112,10 @@ class AsyncOracleConnection(object):
|
|
113
112
|
:return: None
|
114
113
|
"""
|
115
114
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
await self._session_pool.release(connection)
|
115
|
+
async with self._session_pool.acquire() as connection:
|
116
|
+
with connection.cursor() as cursor:
|
117
|
+
await cursor.execute(query)
|
118
|
+
await connection.commit()
|
121
119
|
|
122
120
|
@retry
|
123
121
|
async def safe_execute(self, query: str, packed_values: dict) -> None:
|
@@ -129,11 +127,10 @@ class AsyncOracleConnection(object):
|
|
129
127
|
:return: None
|
130
128
|
"""
|
131
129
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
await self._session_pool.release(connection)
|
130
|
+
async with self._session_pool.acquire() as connection:
|
131
|
+
with connection.cursor() as cursor:
|
132
|
+
await cursor.execute(query, packed_values)
|
133
|
+
await connection.commit()
|
137
134
|
|
138
135
|
@retry
|
139
136
|
async def execute_multiple(self, queries: list[list[str, dict]]) -> None:
|
@@ -144,17 +141,16 @@ class AsyncOracleConnection(object):
|
|
144
141
|
:return: None
|
145
142
|
"""
|
146
143
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
await self._session_pool.release(connection)
|
144
|
+
async with self._session_pool.acquire() as connection:
|
145
|
+
with connection.cursor() as cursor:
|
146
|
+
for item in queries:
|
147
|
+
query = item[0]
|
148
|
+
packed_values = item[1]
|
149
|
+
if packed_values:
|
150
|
+
await cursor.execute(query, packed_values)
|
151
|
+
else:
|
152
|
+
await cursor.execute(query)
|
153
|
+
await connection.commit()
|
158
154
|
|
159
155
|
@retry
|
160
156
|
async def execute_many(self, query: str, dictionary: list[dict]) -> None:
|
@@ -166,11 +162,10 @@ class AsyncOracleConnection(object):
|
|
166
162
|
:return: None
|
167
163
|
"""
|
168
164
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
await self._session_pool.release(connection)
|
165
|
+
async with self._session_pool.acquire() as connection:
|
166
|
+
with connection.cursor() as cursor:
|
167
|
+
await cursor.executemany(query, dictionary)
|
168
|
+
await connection.commit()
|
174
169
|
|
175
170
|
@retry
|
176
171
|
async def fetch_data(self, query: str, packed_data=None):
|
@@ -182,14 +177,13 @@ class AsyncOracleConnection(object):
|
|
182
177
|
:return: rows
|
183
178
|
"""
|
184
179
|
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
await self._session_pool.release(connection)
|
180
|
+
async with self._session_pool.acquire() as connection:
|
181
|
+
with connection.cursor() as cursor:
|
182
|
+
if packed_data:
|
183
|
+
await cursor.execute(query, packed_data)
|
184
|
+
else:
|
185
|
+
await cursor.execute(query)
|
186
|
+
rows = cursor.fetchall()
|
193
187
|
return rows
|
194
188
|
|
195
189
|
@retry
|
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
|