pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedCOPY from a remote machine in Datastage
7+ messages / 4 participants
[nested] [flat]
* COPY from a remote machine in Datastage
@ 2018-10-05 14:05 Ravi Krishna <srkrishna1@aol.com>
0 siblings, 2 replies; 7+ messages in thread
From: Ravi Krishna @ 2018-10-05 14:05 UTC (permalink / raw)
To: ; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
We are doing a POC of using Datastage with PG using ODBC.
Problem to solve: How to load a large CSV file using COPY command. The file is on the client machine.
A typical SQL syntax of a copy coming from a remote machine COPY TABLE FROM STDIN WITH CSV HEADER
Question is, how to make the contents of the file available as STDIN in a SQL. It is easy in a shell.
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: COPY from a remote machine in Datastage
@ 2018-10-05 14:12 Josef Šimánek <josef.simanek@gmail.com>
parent: Ravi Krishna <srkrishna1@aol.com>
1 sibling, 1 reply; 7+ messages in thread
From: Josef Šimánek @ 2018-10-05 14:12 UTC (permalink / raw)
To: srkrishna1@aol.com; +Cc: pgsql-general@lists.postgresql.org
Hello, if you need to use COPY command from remote machine and you use some
libpq bindings (aka ruby pg gem for example), you can use functions
associated with COPY command (
https://www.postgresql.org/docs/10/static/libpq-copy.html). They should be
provided by bindings of postgres library you're using.
If you can share more info, at least how do you access postgres (via Ruby
gem for example or from client's console), I can try to be more descriptive.
Josef
pá 5. 10. 2018 v 16:06 odesílatel Ravi Krishna <srkrishna1@aol.com> napsal:
>
> We are doing a POC of using Datastage with PG using ODBC.
>
> Problem to solve: How to load a large CSV file using COPY command. The
> file is on the client machine.
>
> A typical SQL syntax of a copy coming from a remote machine COPY TABLE
> FROM STDIN WITH CSV HEADER
>
> Question is, how to make the contents of the file available as STDIN in a
> SQL. It is easy in a shell.
>
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: COPY from a remote machine in Datastage
@ 2018-10-05 14:18 Ravi Krishna <srkrishna1@aol.com>
parent: Josef Šimánek <josef.simanek@gmail.com>
0 siblings, 2 replies; 7+ messages in thread
From: Ravi Krishna @ 2018-10-05 14:18 UTC (permalink / raw)
To: ; +Cc: pgsql-general@lists.postgresql.org
>
> Hello, if you need to use COPY command from remote machine and you use some libpq bindings (aka ruby pg gem for example), you can use functions associated with COPY command (https://www.postgresql.org/docs/10/static/libpq-copy.html <https://www.postgresql.org/docs/10/static/libpq-copy.html;). They should be provided by bindings of postgres library you're using.
>
> If you can share more info, at least how do you access postgres (via Ruby gem for example or from client's console), I can try to be more descriptive.
We not writing any Ruby/Python code. We are using Datastage. Datastage has in built features for most of the stuff. For example to bulk load data from csv files
into Oracle/DB2 etc, it has a BULK loader feature. However DS has no support for PG directly and we are piggy backing on ODBC where there is no BULK loader.
The only recourse for us is to type in SQL as DS allows user code.
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: COPY from a remote machine in Datastage
@ 2018-10-05 14:24 Josef Šimánek <josef.simanek@gmail.com>
parent: Ravi Krishna <srkrishna1@aol.com>
1 sibling, 0 replies; 7+ messages in thread
From: Josef Šimánek @ 2018-10-05 14:24 UTC (permalink / raw)
To: srkrishna1@aol.com; +Cc: pgsql-general@lists.postgresql.org
Can you copy your csv to postgres server?
pá 5. 10. 2018 v 16:19 odesílatel Ravi Krishna <srkrishna1@aol.com> napsal:
>
> Hello, if you need to use COPY command from remote machine and you use
> some libpq bindings (aka ruby pg gem for example), you can use functions
> associated with COPY command (
> https://www.postgresql.org/docs/10/static/libpq-copy.html). They should
> be provided by bindings of postgres library you're using.
>
> If you can share more info, at least how do you access postgres (via Ruby
> gem for example or from client's console), I can try to be more descriptive.
>
>
> We not writing any Ruby/Python code. We are using Datastage. Datastage
> has in built features for most of the stuff. For example to bulk load data
> from csv files
> into Oracle/DB2 etc, it has a BULK loader feature. However DS has no
> support for PG directly and we are piggy backing on ODBC where there is no
> BULK loader.
>
> The only recourse for us is to type in SQL as DS allows user code.
>
>
>
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: COPY from a remote machine in Datastage
@ 2018-10-05 14:35 Ron <ronljohnsonjr@gmail.com>
parent: Ravi Krishna <srkrishna1@aol.com>
1 sibling, 1 reply; 7+ messages in thread
From: Ron @ 2018-10-05 14:35 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 10/05/2018 09:18 AM, Ravi Krishna wrote:
>>
>> Hello, if you need to use COPY command from remote machine and you use
>> some libpq bindings (aka ruby pg gem for example), you can use functions
>> associated with COPY command
>> (https://www.postgresql.org/docs/10/static/libpq-copy.html). They should
>> be provided by bindings of postgres library you're using.
>>
>> If you can share more info, at least how do you access postgres (via Ruby
>> gem for example or from client's console), I can try to be more descriptive.
>
> We not writing any Ruby/Python code. We are using Datastage. Datastage
> has in built features for most of the stuff. For example to bulk load data
> from csv files
> into Oracle/DB2 etc, it has a BULK loader feature. However DS has no
> support for PG directly and we are piggy backing on ODBC where there is no
> BULK loader.
>
> The only recourse for us is to type in SQL as DS allows user code.
Can you install the postgres client software (psql) on the client machine
and then have Datastage spawn "psql -c 'COPY ...'"?
--
Angular momentum makes the world go 'round.
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: COPY from a remote machine in Datastage
@ 2018-10-05 14:37 Ravi Krishna <srkrishna1@aol.com>
parent: Ron <ronljohnsonjr@gmail.com>
0 siblings, 0 replies; 7+ messages in thread
From: Ravi Krishna @ 2018-10-05 14:37 UTC (permalink / raw)
To: Ron <ronljohnsonjr@gmail.com>; +Cc: pgsql-general@lists.postgresql.org
>
> Can you install the postgres client software (psql) on the client machine and then have Datastage spawn "psql -c 'COPY ...'"?
That is already an option for us :-)
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: COPY from a remote machine in Datastage
@ 2018-10-05 15:15 Edmundo Robles <edmundo@sw-argos.com>
parent: Ravi Krishna <srkrishna1@aol.com>
1 sibling, 0 replies; 7+ messages in thread
From: Edmundo Robles @ 2018-10-05 15:15 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
if you have ssh access to the client, you can do :
ssh user@client_host "cat /path_to/large_file.csv" | psql -d database
....
On Fri, Oct 5, 2018 at 9:06 AM Ravi Krishna <srkrishna1@aol.com> wrote:
>
> We are doing a POC of using Datastage with PG using ODBC.
>
> Problem to solve: How to load a large CSV file using COPY command. The
> file is on the client machine.
>
> A typical SQL syntax of a copy coming from a remote machine COPY TABLE
> FROM STDIN WITH CSV HEADER
>
> Question is, how to make the contents of the file available as STDIN in a
> SQL. It is easy in a shell.
>
--
^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2018-10-05 15:15 UTC | newest]
Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-10-05 14:05 COPY from a remote machine in Datastage Ravi Krishna <srkrishna1@aol.com>
2018-10-05 14:12 ` Josef Šimánek <josef.simanek@gmail.com>
2018-10-05 14:18 ` Ravi Krishna <srkrishna1@aol.com>
2018-10-05 14:24 ` Josef Šimánek <josef.simanek@gmail.com>
2018-10-05 14:35 ` Ron <ronljohnsonjr@gmail.com>
2018-10-05 14:37 ` Ravi Krishna <srkrishna1@aol.com>
2018-10-05 15:15 ` Edmundo Robles <edmundo@sw-argos.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox