Import CVS file to PostgresDB

Certified Lead Developer

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

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Lead Developer
    in reply to Stefan Helzle

    yeah, I Know. 

    Although the same file, with the same configuration in the smart service except for the data source, with the same tables configurations (everything lowercase), works fine with Appian MariaDb.

    Separator is ; but as it works fine on MariaDb i don't think it's the cause of the issue.

    Unfortunately no, I have no governance on those files and they cannot be avoided as part of the process.

    I can't post those data, but the format is clearly string;string;... Even other reader ov CSV files like the one in DBeaver can read fine the file and query it as it was a table.

    Reading on internet, postgres does not use backtiks to force column names to keep their case type, instead ". Backticks is for MariaDB and mySql.

    I'm afraid it's a bug of the plugin

Children