`CREATE TABLE IF NOT EXISTS `dbcolumns` (`id` INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY, `name` VARCHAR(255) NOT NULL, `pii_type` varchar NOT NULL, `table_id` INTEGER NOT NULL, FOREIGN KEY (`table_id`) REFERENCES `dbtables` (`id`))`
Tested using MySQL 8.0.19 and MySQL 5.7.29 (docker image releases).
log_level="DEBUG"
catalog_format="db"
catalog_host="localhost"
catalog_port="3306"
catalog_user="root"
catalog_password="example"
[db]
host="***.redshift.amazonaws.com"
port="5439"
user="***"
password="***"
database="***"
connection_type="redshift"
scan_type="shallow"
list_all=True
schema=('raw_hr',)
DEBUG:root:PiiTypes are
DEBUG:piicatcher.log_mixin.Table:employee has PiiTypes.PERSON,PiiTypes.EMAIL,PiiTypes.GENDER
DEBUG:piicatcher.log_mixin.Schema:raw_hr has PiiTypes.PERSON,PiiTypes.EMAIL,PiiTypes.GENDER
/Users/piicatcher/venv/lib/python3.7/site-packages/pymysql/cursors.py:170: Warning: (3090, "Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.")
result = self._query(query)
DEBUG:peewee:('SELECT table_name FROM information_schema.tables WHERE table_schema = DATABASE() AND table_type != %s ORDER BY table_name', ('VIEW',))
DEBUG:peewee:('CREATE TABLE IF NOT EXISTS `dbschemas` (`id` INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY, `name` VARCHAR(255) NOT NULL)', [])
DEBUG:peewee:('SELECT table_name FROM information_schema.tables WHERE table_schema = DATABASE() AND table_type != %s ORDER BY table_name', ('VIEW',))
DEBUG:peewee:('CREATE TABLE IF NOT EXISTS `dbtables` (`id` INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY, `name` VARCHAR(255) NOT NULL, `schema_id` INTEGER NOT NULL, FOREIGN KEY (`schema_id`) REFERENCES `dbschemas` (`id`))', [])
DEBUG:peewee:('CREATE INDEX `dbtables_schema_id` ON `dbtables` (`schema_id`)', [])
DEBUG:peewee:('SELECT table_name FROM information_schema.tables WHERE table_schema = DATABASE() AND table_type != %s ORDER BY table_name', ('VIEW',))
DEBUG:peewee:('CREATE TABLE IF NOT EXISTS `dbcolumns` (`id` INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY, `name` VARCHAR(255) NOT NULL, `pii_type` varchar NOT NULL, `table_id` INTEGER NOT NULL, FOREIGN KEY (`table_id`) REFERENCES `dbtables` (`id`))', [])
Traceback (most recent call last):
File "/Users/piicatcher/venv/lib/python3.7/site-packages/peewee.py", line 3057, in execute_sql
cursor.execute(sql, params or ())
File "/Users/piicatcher/venv/lib/python3.7/site-packages/pymysql/cursors.py", line 170, in execute
result = self._query(query)
File "/Users/piicatcher/venv/lib/python3.7/site-packages/pymysql/cursors.py", line 328, in _query
conn.query(q)
File "/Users/piicatcher/venv/lib/python3.7/site-packages/pymysql/connections.py", line 517, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/Users/piicatcher/venv/lib/python3.7/site-packages/pymysql/connections.py", line 732, in _read_query_result
result.read()
File "/Users/piicatcher/venv/lib/python3.7/site-packages/pymysql/connections.py", line 1075, in read
first_packet = self.connection._read_packet()
File "/Users/piicatcher/venv/lib/python3.7/site-packages/pymysql/connections.py", line 684, in _read_packet
packet.check_error()
File "/Users/piicatcher/venv/lib/python3.7/site-packages/pymysql/protocol.py", line 220, in check_error
err.raise_mysql_exception(self._data)
File "/Users/piicatcher/venv/lib/python3.7/site-packages/pymysql/err.py", line 109, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL, `table_id` INTEGER NOT NULL, FOREIGN KEY (`table_id`) REFERENCES `dbta' at line 1")