0

I have this petl table in Python that I want to connect to a local PostgreSQL database. But some petl table headers are in uppercase. eg, ID not id.

I realised that when I tried to append the table to the PostgreSQL, the headers were not recognised.

Error code: column "UPPERCASE_HEADER" of relation "sql_table" does not exist.

I had to change the petl table headers to be lowercase before the table was appended to SQL successfully.

But if I wanted to leave the headers as uppercase, is there a way to still append to PostgreSQL table? Since PostgreSQL table headers are always lowercase.

David Obembe
  • 101
  • 2
  • 7
  • See Postgres documentation for [string functions](https://www.postgresql.org/docs/14/functions-string.html), upper, lower, and initcap. Also see documentation for [ilike](https://www.postgresql.org/docs/14/functions-matching.html#FUNCTIONS-LIKE) operator. – Belayer Jan 14 '22 at 19:52
  • I would simply create two PETL tables. One with the headers matching SQL, and another as you exactly want them in the rest of your application (mixed case column names). You could also rename the headers, perform your database operations, and then map back to the originals if you only want to use one PETL table. – Copy and Paste Feb 09 '22 at 21:53

0 Answers0