I am using pg8000 for Postgres api in my python package. I created a function that is to create a table is no such table exists. The function is below:
def create_tables(self, cur, tables):
for i, table in enumerate(tables):
name = 'important_' + table
query = '''CREATE TABLE IF NOT EXISTS {} (
{} CHAR(9),
{} DATE,
{} DECIMAL,
{} TIME,
{} TIME,
{} NUMERIC,
{} CHAR,
{} CHAR,
{} DECIMAL
)
'''.format(name, "key", "date", "cycle_sequence", "sent_time","processed_time", "amount", "sender", "receiver", "jumbo")
cur.execute(query)
The query runs without error (in program and an online fiddle here) except that the table column names are for example: "key CHAR(9)", "date DATE", etc. So the query is executing but not recognizing the syntax. But the query syntax is correct according to this. Any tips?
NOTE 1: There is a similar question here but I do not have similar symptoms because I do not get a syntax error. My query is successful.