public inbox for [email protected]  
help / color / mirror / Atom feed
From: Andy Hartman <[email protected]>
To: Muhammad Usman Khan <[email protected]>
Cc: [email protected]
Subject: Re: load fom csv
Date: Tue, 17 Sep 2024 08:31:49 -0400
Message-ID: <CAEZv3cpoBmkAanxUnuFXB=J-DwP+aSbL=FaK-U8CnrzO7r7p5Q@mail.gmail.com> (raw)
In-Reply-To: <CAPnRvGvs1fYmBsg+K=HwtxVJr+on1YBcW0vK_t=hzm9soDaj8g@mail.gmail.com>
References: <CAEZv3cqEZyUouS_0tCcUG1UOi6C0VcYLgoneq-Atf8i+ikge1A@mail.gmail.com>
	<CAPnRvGvs1fYmBsg+K=HwtxVJr+on1YBcW0vK_t=hzm9soDaj8g@mail.gmail.com>

I have bad data in an Int field...

 Thanks for your help.

On Tue, Sep 17, 2024 at 1:55 AM Muhammad Usman Khan <[email protected]>
wrote:

> Hi,
> Try the following options:
>
>
>    - Check if psql is working independently:
>    psql -h $pgServer -d $pgDatabase -U $pgUser -c "SELECT 1;"
>    - Check for permission issues on the CSV file
>    - Run the command manually without variables
>    psql -h your_host -d your_db -U your_user -c "\COPY your_table FROM
>    'C:/path/to/your/file.csv' DELIMITER ',' CSV HEADER;"
>    - set a timeout using the PGCONNECT_TIMEOUT environment variable:
>    $env:PGCONNECT_TIMEOUT=30
>
>
>
> On Mon, 16 Sept 2024 at 20:35, Andy Hartman <[email protected]>
> wrote:
>
>> I'm trying to run this piece of code from Powershell and it just sits
>> there and never comes back. There are only 131 records in the csv.
>>
>> $connectionString =
>> "Host=$pgServer;Database=$pgDatabase;Username=$pgUser;Password=$pgPassword"
>> $copyCommand = "\COPY $pgTable FROM '$csvPath' DELIMITER ',' CSV HEADER;"
>>
>> psql -h $pgServer -d $pgDatabase -U $pgUser -c $copyCommand
>>
>>
>> how can I debug this?
>>
>> Table layout
>>
>> [image: image.png]
>>
>


Attachments:

  [image/png] image.png (65.2K, 3-image.png)
  download | view image

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: load fom csv
  In-Reply-To: <CAEZv3cpoBmkAanxUnuFXB=J-DwP+aSbL=FaK-U8CnrzO7r7p5Q@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox