Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. url = "jdbc:postgresql://host:port/db_name?rewriteBatchedStatements=true"
  2. properties = {"user":"user_name","password":"password"}
  3. df = spark.createDataFrame(rdd_name)
  4. df.write.jdbc(url=url, table="table_name", mode="append", properties=properties)
  5.  
  6. : org.postgresql.util.PSQLException: ERROR: relation "table_name" already exists
  7. at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2455)
  8. at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2155)
  9. at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:288)
  10. at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:430)
  11. at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:356)
  12. at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:303)
  13. at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:289)
  14. at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:266)
  15. at org.postgresql.jdbc.PgStatement.executeUpdate(PgStatement.java:246)
  16. at org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils$.createTable(JdbcUtils.scala:692)
  17. at org.apache.spark.sql.execution.datasources.jdbc.JdbcRelationProvider.createRelation(JdbcRelationProvider.scala:89)
  18. at org.apache.spark.sql.execution.datasources.DataSource.write(DataSource.scala:426)
  19. at org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:215)
  20. at org.apache.spark.sql.DataFrameWriter.jdbc(DataFrameWriter.scala:446)
  21. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  22. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  23. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  24. at java.lang.reflect.Method.invoke(Method.java:497)
  25. at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
  26. at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
  27. at py4j.Gateway.invoke(Gateway.java:280)
  28. at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
  29. at py4j.commands.CallCommand.execute(CallCommand.java:79)
  30. at py4j.GatewayConnection.run(GatewayConnection.java:214)
  31. at java.lang.Thread.run(Thread.java:745)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement