1

Trying to create a table in teradata using Sqlalchemy. This is the command -

df_depts.to_sql('AT_tryout',engine,index= False, if_exists ='replace',dtype={"similarity": BIGINT ,"inputs": CLOB ,"recommendations": CLOB})

Any idea of why I am getting unable to create index error.

Enitre error looks like this -

sqlalchemy.exc.DatabaseError: (teradata.api.DatabaseError) (5660, '[HY000] [Teradata][ODBC Teradata Driver][Teradata Database] Cannot create index on LOB columns. ') [SQL: '\nCREATE TABLE "AT_tryout" (\n\tinputs CLOB(255), \n\trecommendations CLOB(255), \n\tsimilarity BIGINT\n)\n\n'] (Background on this error at: http://sqlalche.me/e/4xp6)

Any help is appreciated. Thank you.

Analyst17
  • 153
  • 2
  • 11
  • When creating a table, if you don't specify a column for the PI, Teradata takes the first column in the table as the PI. In your case, that column (`inputs`) is a CLOB. As the error states, Teradata cannot create an index on a LOB column. – Andrew Jan 11 '19 at 20:35
  • Is there a different data type that we can use other than CLOB for large text.? I tried with TEXT and it doesnt work. – Analyst17 Jan 11 '19 at 20:46
  • 1
    There's a VarChar up to 64k (Latin) or 32k (Unicode). What are you trying to store? If there's no other column besides that CLOB you could try `no primary index` – dnoeth Jan 11 '19 at 21:34

0 Answers0