Gpload - AttributeError: 'NoneType' object has no attribute 'lower'
Symptoms:
Failure occurs when running gpload:
File "/usr/local/greenplum-loaders-5.28.14/bin/gpload.py", line 1895, in read_columns
self.from_columns.append([col_name,d[key].lower(),None, False])
AttributeError: 'NoneType' object has no attribute 'lower'
2023-02-09 06:51:20|ERROR|unexpected error -- backtrace written to log file
2023-02-09 06:51:20|INFO|rows Inserted = 0
2023-02-09 06:51:20|INFO|rows Updated = 0
2023-02-09 06:51:20|INFO|data formatting errors = 0
2023-02-09 06:51:20|INFO|gpload failedGreenplum Database.
The AttributeError indicates that gpload.py is receiving an incorrectly formatted or missing column which cannot be used with the 'lower' function.
Depending on the gpload YAML configuration file input for 'Columns', gpload may be interpreting the data columns according to the source file data types. By default the input is the same as the source data.Default:
If the input `COLUMNS` are not specified, then the schema of the output `TABLE` is implied, meaning that the source data must have the same column order, number of columns, and data format as the target table.
Check the gpload configuration file to determine if 'Columns' have been formatted correctly:
---
VERSION: 1.0.0.1
DATABASE: ops
USER: gpadmin
HOST: mdw-1
PORT: 5432
GPLOAD:
INPUT:
- SOURCE:
LOCAL_HOSTNAME:
- etl1-1
- etl1-2
- etl1-3
- etl1-4
PORT: 8081
FILE:
- /var/load/data/*
- COLUMNS:
- name: text
- amount: float4
- category: text
- desc: text
- date: date
- FORMAT: text
- DELIMITER: '|'
- ERROR_LIMIT: 25
- LOG_ERRORS: true
OUTPUT:
- TABLE: sch01.tbl01
- MODE: INSERT
PRELOAD:
- REUSE_TABLES: true
SQL:
- BEFORE: "INSERT INTO audit VALUES('start', current_timestamp)"
- AFTER: "INSERT INTO audit VALUES('end', current_timestamp)"
If 'Columns' has not been specified, check for differences between the data source and destination table formatting.
Either specify the 'Columns' configuration according to the destination table format or adjust the destination/source data formatting to match.