Skip to content

Commit 89c5a51

Browse files
authored
Merge pull request #178 from rwnx/177-postgres-datetime-is-not-a-valid-type
use TIMESTAMP in postgres datetimes
2 parents 0153ae0 + 096e2ef commit 89c5a51

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1717
-------------------------------------------------------------------
1818
## [Unreleased]
1919
## Fixed
20+
- Fixed an issue where postgres seed table was using invalid datatype `DATETIME`. changed to `TIMESTAMP`
2021
- Fixed a issue when updates to MSSQL data would result in multiple messages coming back from the server, e.g. when triggers update multiple tables and NOCOUNT is OFF. Another scenario is before or after scripts that call stored procs wth PRINT statements in them or that return multiple resultsets before completing. Without the fix, this issue can result in tables only partially anonymized.
2122
- Fix error messages when running MSSQL anonymization with --verbose enabled
2223

pynonymizer/database/mssql/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,14 @@ def __execute_ddl(self, statement, *args):
157157
if self.timeout:
158158
c.timeout = self.timeout
159159
return c.execute(statement, *args)
160-
160+
161161
def __execute_server(self, statement, *args):
162162
logger.debug("sql: %s, args: %s", statement, args)
163163
c = self.__connection()
164164
# If timeout is set, then apply it to the connection. PyODBC will then assign that value to the Cursor created during execute()
165165
if self.timeout:
166166
c.timeout = self.timeout
167-
return c.execute(statement, *args)
167+
return c.execute(statement, *args)
168168

169169
def __get_path(self, filepath):
170170
if "\\" in filepath:

pynonymizer/database/postgres/query_factory.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
_FAKE_COLUMN_TYPES = {
1010
FakeDataType.STRING: "VARCHAR(65535)",
1111
FakeDataType.DATE: "DATE",
12-
FakeDataType.DATETIME: "DATETIME",
12+
FakeDataType.DATETIME: "TIMESTAMP",
1313
FakeDataType.INT: "INT",
1414
}
1515

tests_integration/postgres/pagila.yml

+1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ tables:
1717
columns:
1818
first_name: first_name
1919
last_name: last_name
20+
last_update: past_datetime
2021
film_actor: truncate
2122
film_category: delete

0 commit comments

Comments
 (0)