Skip to main content
alessandrom1708
March 29, 2024
Question

Import CVS file to PostgresDB

  • March 29, 2024
  • 11 replies
  • 0 views

Hi,

I'm trying to import a CSV file into a PostgreSQL DB.

Customer requires all data from appian must rely on that DB which is connected as datasource.

I'm using the plug in Excel tool and the Smart Service Import CSV to Database. 

I got the following error from stdOut log:

 

ERROR ImportCsvToDatabase8 Error executing SQL
 org.postgresql.util.PSQLException: ERROR: syntax error at or near ","
  Position: 17

From database, i turned statements log on and i found out the following statement: 

2024-03-29 17:32:08 UTC:10.245.48.249(51148):appian@postgres:[3319]:ERROR: syntax error at or near "," at character 17
2024-03-29 17:32:08 UTC:10.245.48.249(51148):appian@postgres:[3319]:STATEMENT: select `field1`, `field2` from `table` where 1=0
2024-03-29 17:32:08 UTC:10.245.48.249(51148):appian@postgres:[3319]:LOG: execute S_1: ROLLBACK

I'm running the same statement on my client in Postgres and i got the same error of course.

What I found out is that backtick is causing problems as it as a different use on o Postgres than MariaDb.

Do you know any workaround to bypass this problem?

Something to skip/bypass the backtick and use something different?

Thanks a lot

Alessandro

11 replies

stefanhelzle0001
March 29, 2024

Do you need to do this frequently? If not, did you consider to just import that file directly using a DB tool?

alessandrom1708
March 29, 2024

yes, very frequently. It's a core process.

stefanhelzle0001
March 29, 2024

CSV files can be tricky, because there is not clearly defined format.

Are you sure that the DB error message relates to the import? It's a select statement.

Do you have any influence on how that file is created?

Is there any option to send that data to Appian avoiding that CSV file?

Can you post a row of that CSV file?

Did you try the various separator options in the smart service?