Using PostgreSQL COPY FROM STDIN
NickName:synapse Ask DateTime:2022-11-23T06:07:24

Using PostgreSQL COPY FROM STDIN

Is it possible to use PostgreSQL's COPY FROM STDIN statement to load data from CSV file by passing some sort of Reader or Writer object the same way it's done in Java? What library should I use? Kotlin example for reference:

val cm = CopyManager(conn as BaseConnection)
val total = cm.copyIn("COPY my_table FROM STDIN FORMAT csv", inputStream)

Copyright Notice:Content Author:「synapse」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/74539520/using-postgresql-copy-from-stdin

More about “Using PostgreSQL COPY FROM STDIN” related questions

PostgreSQL copy command using STDIN

I need to load the data from the CSV file to table in PostgreSQL. and I'm not a superuser to use the copy command. when i read few topics from the postgreSQL site I came to know abut the \copy comm...

Show Detail

Using PostgreSQL COPY FROM STDIN

Is it possible to use PostgreSQL's COPY FROM STDIN statement to load data from CSV file by passing some sort of Reader or Writer object the same way it's done in Java? What library should I use? Ko...

Show Detail

COPY to POSTGRESQL from STDIN in Python / Django (on Heroku)

I'm setting up a Django app on Heroku and need to convert from an sqlite3 db backend to postgresql. Unfortunately, I'm using a shared database and so cannot get direct access to the db shell with ...

Show Detail

Redshift copy from STDIN using java program

I have Java program that works fine on Postgres, but while in migration to Redshift, I want this Postgres program to run on Redshift. In Postgres I used following classes, and I'm trying to use s...

Show Detail

Importing bytea data into PostgreSQL by using COPY FROM stdin

I generated a (UTF-8) file by an external program for importing into PostgreSQL 9.6.1. Problem is the bytea field (PWHASH). Snippet from this file (using TAB as delimiter) COPY USERS (ID,CODE,PWH...

Show Detail

Copy from stdin in Oracle

I'm using jdbc to connect my backend to an OracleDB. Is there a PostgreSQL-like COPY ... FROM STDIN (...) in OracleDB, or something equally quick? I should be able to insert over 1 Million entr...

Show Detail

PostgreSQL COPY FROM STDIN not working, but FROM PATH works

In PostgreSQL I previously created a table like so: CREATE TABLE IF NOT EXISTS stock_data ( code varchar, date date, open decimal, high decimal, low decimal, close decimal, volume de...

Show Detail

Convert Pandas dataframe to format suitable for PostgreSQL COPY ... FROM STDIN

Given a Pandas dataframe, how can it be converted to a form suitable for PostgreSQL's COPY FROM STDIN (ideally in TEXT mode)? A naive way would be: text = df.to_csv( index=False, header=Fal...

Show Detail

Using COPY FROM STDIN in a stored function

I'm trying to copy data into a table from a stored PostgreSQL function. The data of rows and the table name are received from a java program and the part that causes errors is this one: _copyquery...

Show Detail

COPY from stdin PostgreSQL

I am having a hard time with this bulk copy syntax. Looks to me like I followed the correct syntax from a tutorial i checked out. But there seems to be a syntax error that i cannot detect. Need som...

Show Detail