Table in PostgreSQL DB:
id SERIAL PRIMARY KEY, link VARCHAR(128), title VARCHAR(128), summary VARCHAR(2048), content VARCHAR(16384), published TIMESTAMPTZ Insert record (Python, py-postgresql):
insert = _database.prepare( "INSERT INTO SchemaName.TableName (link, title, summary, content, published) VALUES ($1, $2, $3, $4, $5)" ) … insert(link, title, summary, content, published.strftime('%Y-%m-%d %H:%M:%S %z')) # published — datetime, остальное — str Execution causes an error:
could not pack parameter $5::TIMESTAMP WITH TIME ZONE for transfer … LOCATION: CLIENT DETAIL: '2018-11-08 01:38:31 -0500' What am I doing wrong?
published, then the driver will convert the python object into a database object? - gil9red