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 1jS0wX-0006mb-Vs for pgsql-general@arkaria.postgresql.org; Fri, 24 Apr 2020 16:12:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jS0wW-0002pT-5a for pgsql-general@arkaria.postgresql.org; Fri, 24 Apr 2020 16:12:44 +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 1jS0wV-0002kx-Rh for pgsql-general@lists.postgresql.org; Fri, 24 Apr 2020 16:12:43 +0000 Received: from mail-bn8nam12on2066.outbound.protection.outlook.com ([40.107.237.66] helo=NAM12-BN8-obe.outbound.protection.outlook.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jS0wN-0002BR-GL for pgsql-general@postgresql.org; Fri, 24 Apr 2020 16:12:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PIP9nxN7/415lb2+B1TvItjGkZyZY9j+SV9clzHOUOBFNYrXya8ljn34/Qywow/g0HLN36RXpaJjVZ72vF1ZCxbnaRctCB7+uIIvlmWIUSl9/en3gcBXMAAczcPG5hJUc+Fj80SZy90B9bg1L+bUmX1Gh1IjoKktI1GaPRKcfdxT4vcg2uc+bL2rBHlTWISaIXsD/ir1094BxpYuGrIbxcY0AecohF5bwru/f6vSgzzZ+mkAkHrR6JKTG+fk1Fd8XQkdZAPxwJBSamjdXZoAexwSKDVokQtiGQhhROZIDqeJG4c1E/SCv+nUI8LsS1hhhdh74q9+qxBngtMQCt14CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DuaGPhuETC5WpYo8LESzXhma3N88UIZGxGW0hYy3GD0=; b=jhuLGRXzqmafxNcoz/cJqjKPLxeywN204Dh2hc/iGkjFemUKklukowIjmA/RaxOU8gyfjpD1E0W27OHxCaeqjOVZBSaI0iyy5r6gAEgeGcDJ0OWeBvpTLcOG0UtET+ta6IFMQHhzPtllnBBEbm6M393OwA8QqP1+HycTfdTsTf/0QG1FNem6kE8Yxa1Eh7nWfMLo9/2vzwDeAotTvdZ+J+C41ZwH6lN9nwx4lilfRJM4Her4gyxDrRwgViG3oduumMyleFjtSmmQouvUu24oExv/dpKp4JtsI+AxpuOxuRo0AfQh6o7fAcypv4gD1rKsfpxf0eEV8xIvWzkZbTEJ/g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=netwolves.com; dmarc=pass action=none header.from=netwolves.com; dkim=pass header.d=netwolves.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vasotechnology.onmicrosoft.com; s=selector2-vasotechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DuaGPhuETC5WpYo8LESzXhma3N88UIZGxGW0hYy3GD0=; b=zMQm2jjD+++CbuRVSt4piuNl7k6tD6d26QKVHGTbMJxwJVyRZijRinCNcGlWLHBNB3d3VvF44HuFqwXUvCAmWIQHncQPieprjDRcbgLI9+/RsD6TdTykL1gvvqZwJR+D0P65ZnaCI1rEpSHG5L13qhB8ZqVHBBNlkxydVUUQOA4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=steve.clark@netwolves.com; Received: from DM6PR16MB2971.namprd16.prod.outlook.com (2603:10b6:5:125::32) by DM6PR16MB3832.namprd16.prod.outlook.com (2603:10b6:5:2bf::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13; Fri, 24 Apr 2020 16:12:32 +0000 Received: from DM6PR16MB2971.namprd16.prod.outlook.com ([fe80::cd54:4089:55bc:87bd]) by DM6PR16MB2971.namprd16.prod.outlook.com ([fe80::cd54:4089:55bc:87bd%4]) with mapi id 15.20.2921.030; Fri, 24 Apr 2020 16:12:32 +0000 Subject: Re: psql \copy References: To: pgsql From: Steve Clark Message-ID: Date: Fri, 24 Apr 2020 12:12:30 -0400 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------DD49B52427D82C58772979AA" X-ClientProxiedBy: BL0PR01CA0029.prod.exchangelabs.com (2603:10b6:208:71::42) To DM6PR16MB2971.namprd16.prod.outlook.com (2603:10b6:5:125::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sclark66.netwolves.com (173.65.53.194) by BL0PR01CA0029.prod.exchangelabs.com (2603:10b6:208:71::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2937.13 via Frontend Transport; Fri, 24 Apr 2020 16:12:32 +0000 X-Originating-IP: [173.65.53.194] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bedd0daf-18d0-471b-0020-08d7e86a4b61 X-MS-TrafficTypeDiagnostic: DM6PR16MB3832: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2657; X-Forefront-PRVS: 03838E948C X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR16MB2971.namprd16.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(136003)(39840400004)(346002)(366004)(396003)(376002)(8676002)(52116002)(478600001)(7696005)(6486002)(44832011)(33964004)(26005)(53546011)(966005)(31686004)(316002)(36756003)(6916009)(5660300002)(2906002)(16526019)(81156014)(86362001)(8936002)(66476007)(66556008)(66946007)(31696002)(956004)(2616005)(186003);DIR:OUT;SFP:1101; Received-SPF: None (protection.outlook.com: netwolves.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Opo/2977l8/JCH4p57ixt34GLni8rUGtiRhvJClEjcddsitq2WlsY0L05H5ODWHff9DhLVltkA78lvGMdLronf4241zHWFQyT+wifx6Whmc9R14rCAhbLpmLsA+BD+7AmNXEwZNxo3kV8dGCSBRaJhFK+6XcL+z4Y9XiNpySUyQ0hllmcZ8cM2/85IAZ2wOUSsDUS7Z8R0TapeiJ4Dk7o31D4K4VAltoLK9+SmHtv0+xbiUEUFTZMGnHofF4F2bisQURbOZI3FnFrgZdpY08yMJtmGMUzZb5wTEpJoRoBBpDsOscJAkKqwvdeeebyISm+NDa7UhM/yiOsIa42MMN/W02a8d/sFraMKeIHPIzzKXjdKP5drZsyBirIymL2OnPNkVwH47aT9iDUDacmz+ce9+0QaevcFBvLQVteJuA7clB7NG4+nLN7KVeaqtztgVIST4i1FraGl5R44r0XiAZQB1hRWggvReA5Q5LyCIJ+GPfCSA5skt1z8RnVg3ClAnxH/IX5Q66GSEgieTf2WAcOA== X-MS-Exchange-AntiSpam-MessageData: XDqI3HWo3vyrrKyS1LJsgNzQtPTXIKD7yqKB/ryaj8N0Ye6p2rhGaa7du4LjaNddYbOKC16YynTAgyx+pjpp5dHh0rxGiljT1EpkvoVXU8j8Ff4WLyxfrg7YVsgygpF4I8vpOHortlPAt5px01juhA== X-OriginatorOrg: netwolves.com X-MS-Exchange-CrossTenant-Network-Message-Id: bedd0daf-18d0-471b-0020-08d7e86a4b61 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2020 16:12:32.6779 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0e6b4e23-9de7-4714-baad-e7fd020c938f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: UkE9GE0xM6eBhMZCEkotY0Vhh0FYVXJsxwnAN8lLWZ7LlljHxCY3URGw992/RKKkTiLN+2nZVMx/BxLFuoP6vA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR16MB3832 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --------------DD49B52427D82C58772979AA Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: quoted-printable 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 1= 5 minutes of data from the InfluxDB as csv data and pipe it into a psql -c "\copy...." command. I was looking f= or the simplest way to do this. -- 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 Email Confidentiality Notice: The information contained in this transmissio= n may contain privileged and confidential and/or protected health informati= on (PHI) and may be subject to protection under the law, including the Heal= th Insurance Portability and Accountability Act of 1996, as amended (HIPAA)= . This transmission is intended for the sole use of the individual or entit= y to whom it is addressed. If you are not the intended recipient, you are n= otified that any use, dissemination, distribution, printing or copying of t= his transmission is strictly prohibited and may subject you to criminal or = civil penalties. If you have received this transmission in error, please co= ntact the sender immediately and delete this email and any attachments from= any computer. Vaso Corporation and its subsidiary companies are not respon= sible for data leaks that result from email messages received that contain = privileged and confidential and/or protected health information (PHI). --------------DD49B52427D82C58772979AA Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On 04/24/2020 11:59 AM, Steve Crawford wrote= :
On Fri, Apr 24, 2020 at 8:55 AM Steve Clark <steve.clark@net= wolves.com> 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 prepro= cess then copy to your permanent table or use an ETL solution to remove unw= anted data before importing. I don't know the nature of your data or projec= t 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 1= 5 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.

--
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

Email Confidentiality Notice: The information contained in this transmissio= n may contain privileged and confidential and/or protected health informati= on (PHI) and may be subject to protection under the law, including the Heal= th Insurance Portability and Accountability Act of 1996, as amended (HIPAA). This transmission is intended for the sol= e use of the individual or entity to whom it is addressed. If you are not t= he intended recipient, you are notified that any use, dissemination, distri= bution, printing or copying of this transmission is strictly prohibited and may subject you to criminal or civ= il penalties. If you have received this transmission in error, please conta= ct the sender immediately and delete this email and any attachments from an= y computer. Vaso Corporation and its subsidiary companies are not responsible for data leaks that result fr= om email messages received that contain privileged and confidential and/or = protected health information (PHI). --------------DD49B52427D82C58772979AA--