Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jS0zt-0006tU-IH for pgsql-general@arkaria.postgresql.org; Fri, 24 Apr 2020 16:16:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jS0zs-0000mu-DJ for pgsql-general@arkaria.postgresql.org; Fri, 24 Apr 2020 16:16:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jS0zs-0000m9-5h for pgsql-general@lists.postgresql.org; Fri, 24 Apr 2020 16:16:12 +0000 Received: from [64.147.123.20] (helo=wout4-smtp.messagingengine.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jS0zm-0002DR-RW for pgsql-general@postgresql.org; Fri, 24 Apr 2020 16:16:11 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 5D3F7152D; Fri, 24 Apr 2020 12:15:54 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 24 Apr 2020 12:15:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=a UV2FUHcysZPtzxW80SLVRnvpJDSQFGWb+KO8Y71Xo8=; b=p3VSAZPfLs/93DS5B gUBmUjKFNCw0VF2KKxFBsEYKPnidvuvEWSb+i/Qfo7CurrCvfUKc4/Vpr4R26yAc nH+KLdbt5zKsISXpFJv+rgQL+xsEWEWlpRbkeMKM1wJNGQukFmkYXpsvkxxhlyVd z7+qEaT0Gyx95zyf0z84eWm2OfhaEDnn4ympaqWfzQq187PfLPUoOW0Xk2Ovtqnl TMt/fQxHVzyYZfdX9YtNX9rXaeEuPHOQ1cSirKcKeyQ7HTImswT3dv+o6KYXFZdj xJSIzdWb7R6mcEFb1NYGknAKtLtgXtjp2N3duN//XRD3WPZ1pR1vxP7BzTx/eGod X+wEQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=aUV2FUHcysZPtzxW80SLVRnvpJDSQFGWb+KO8Y71X o8=; b=ef6hcv5+JwBCbedu+PA5V1zKNxNlBlH2tUI/pbAHd+4virXjplZRc3mRz 40bp7Pukqoa2byVKcWNGNIbuhSjKVEpl9nau2EfU475CWqSt/e887nAWTcF4U+iE RbyJumtYEmEVM4AdgeU4jcL/xjetK9fOa8uqNzx8t0U31DJlF34kN/JugonWIhkT tHe3yeGm95qVCkWX0Ne98vUkXEl53SAlyNTAg3pAypHIVxVHCrSTfLcuolB4jgTT 1fHeeb1SX3imTLpLVujFOiWzuOumvd7fA1drJYyxe6NXUsWI+8JrEm5dzzakW1JT +cf9K1hbfv+68mt0YvxOxvjoqzTxg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrhedugdelgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuvfhfhffkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughrihgr nhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh eqnecuffhomhgrihhnpehnvghtfiholhhvvghsrdgtohhmnecukfhppeeljedruddufedr vddtjedrudefkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Received: from [192.168.1.10] (97-113-207-138.tukw.qwest.net [97.113.207.138]) by mail.messagingengine.com (Postfix) with ESMTPA id 255743280060; Fri, 24 Apr 2020 12:15:53 -0400 (EDT) Subject: Re: psql \copy To: Steve Clark , pgsql References: From: Adrian Klaver Message-ID: Date: Fri, 24 Apr 2020 09:15:52 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 64.147.123.20 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 4/24/20 9:12 AM, Steve Clark wrote: > On 04/24/2020 11:59 AM, Steve Crawford wrote: >> On Fri, Apr 24, 2020 at 8:55 AM Steve Clark > > wrote: >> >> Hello, >> >> I am using psql to copy data extracted from an InfluxDB in csv >> format into postgresql. >> I have a key field on the time field which I have defined as a >> bigint since the time I get >> from InfluxDB is an epoch time. >> >> My question is does psql abort the copy if it hits a duplicate >> key, or does it keep processing? >> >> >> The copy will fail. You could import into a temporary table and >> preprocess then copy to your permanent table or use an ETL solution to >> remove unwanted data before importing. I don't know the nature of your >> data or project but perhaps that column isn't suitable for a key. >> >> Cheers, >> Steve > I am attempting to periodically pull time series data from an InfluxDB. > The column at issue is the timestamp. I have a script that pulls the > last 15 minutes of data from the InfluxDB > as csv data and pipe it into a psql -c "\copy...." command. I was > looking for the simplest way to do this. Then as suggested above pull into staging table that has no constraints e.g. PK. Verify data and then push into permanent table. > > -- > Stephen Clark > *NetWolves Managed Services, LLC.* > Sr. Applications Architect > Phone: 813-579-3200 > Fax: 813-882-0209 > Email: steve.clark@netwolves.com > http://www.netwolves.com -- Adrian Klaver adrian.klaver@aklaver.com