awslabs / amazon-redshift-utils

Amazon Redshift Utils contains utilities, scripts and view which are useful in a Redshift environment
Apache License 2.0
2.76k stars 1.25k forks source link

SystemTablePersistence - Value too long for character type error #716

Open felixep opened 5 months ago

felixep commented 5 months ago

Hello team,

I'm getting the following error when I execute the SystemTablePersistence lambda utility:

ERROR] ProgrammingError: {'S': 'ERROR', 'C': 'XX000', 'M': 'Value too long for character type', 'D': '\n -----------------------------------------------\n error: Value too long for character type\n code: 8001\n context: Value too long for type character(30)\n query: 213818\n location: string.cpp:213\n process: query0_113_213818 [pid=25354]\n -----------------------------------------------\n', 'F': '../src/sys/xen_execute.cpp', 'L': '12414', 'R': 'pg_throw'} Traceback (most recent call last): File "/var/task/lambda_function.py", line 148, in event_handler snapshot_system_stats.snapshot([config, os.environ]) File "/var/task/lib/SystemTablePersistence/snapshot_system_stats.py", line 247, in snapshot insert_rowcounts = snapshot_system_tables(cursor, conn, table_config) File "/var/task/lib/SystemTablePersistence/snapshot_system_stats.py", line 98, in snapshot_system_tables cursor.execute(stmt) File "/var/task/lib/redshift_connector/cursor.py", line 231, in execute self._c.execute(self, operation, args) File "/var/task/lib/redshift_connector/core.py", line 1800, in execute self.handle_messages(cursor) File "/var/task/lib/redshift_connector/core.py", line 1986, in handle_messages raise self.error

Solution:

And the solution is to increase the size of the field "label" in here

In my case the values were between 30 to 50 but I made it CHAR(100) for the moment.