Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sc54V-003jTT-S5 for pgsql-admin@arkaria.postgresql.org; Thu, 08 Aug 2024 15:28:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sc54T-00F3vP-9b for pgsql-admin@arkaria.postgresql.org; Thu, 08 Aug 2024 15:28:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sc54S-00F3vH-Se for pgsql-admin@lists.postgresql.org; Thu, 08 Aug 2024 15:28:56 +0000 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sc54Q-003oso-9C for pgsql-admin@lists.postgresql.org; Thu, 08 Aug 2024 15:28:56 +0000 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-52f04b3cb33so2345896e87.0 for ; Thu, 08 Aug 2024 08:28:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723130932; x=1723735732; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=GOepHmIzdy230egJdxtoauRgttADGztH8GnQT17ik4U=; b=GEkNvtxMugfEqdhSTHCe+37PJtCk5zjLWyVU1Mm0doO5od4+K2vG7ExSyRYrgCAFhc rLroLWacY/nMdPRkz+ryaM9/7Nk9Yt0gxOlpcPVpM7M+pLRKAY6He9p8MeSn5A0XGsOq H/tsyo9Y8ijxVzyb08M0Fte2LwuOWraGy2e/5wEbBZ27VF45BtmV/2DOGGu4SUOB5fA0 /oirz2h1iPLVGLVcus/uXF2EvGDDAxL6jWQo4YzQFV19mBA6UEwsGmyjYOohLY88GF2p Wk+GzJoXl2UAo+EPXCgiXR3cvhEFrKPzEE4XTQ9FvuVC6EFsesl2Tc0tfd33nuZRseIC yMxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723130932; x=1723735732; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=GOepHmIzdy230egJdxtoauRgttADGztH8GnQT17ik4U=; b=LORckLfYnuW7XFo3HRO7YxfewBrGm4T8lEuirWLFMSIHSSy5WPpLXUW0SJUjWkmz5S G2JmTNmp3YxC4tuY6aQJTaAV+4h5ZMFgIDRIy671sgsMVlVcirnaTBA8Rn88gx14oRrq hfELxHAslpneA+hno8vcBhmzesPwLBHN5ansADRvzt8NgOF9sTqFEXhIGqlmyxTQDFug Uk8YKlyN5ukmJIDLTs2x9k3FnMNf3zyGdXbW+qWiWUHuOogtGWi3hseyg61S94TCoajx utYpptLR31wTYu9MR1D6xs035OFFaXsY720tlXaQF7mP3gbQevX6BAtRlvwdAqnXcoqf ZDbw== X-Gm-Message-State: AOJu0Yzd7DVCzXMBkEK27PLXl3Mx4mWONySBqoCUlJ1aoYDbzhezLRnr 1ZFGelEcYwSIdWKGt3Od2Rhb+n/iODXkfvDHlSx75CAd+JohETXlJzqGQZY+uXbbcbC+AGpPibO a3Iykwh6qXkYrYyW72vPdT0HrIT4= X-Google-Smtp-Source: AGHT+IHxNogGX7b/bGje4xlQwfE2iDirfMsFcY1eGPmccRAAneC77ykVzk7LHkOyVIBrL+NRGhDDIIC4oU7kbeSoWhg= X-Received: by 2002:ac2:4c4d:0:b0:52c:e091:66e4 with SMTP id 2adb3069b0e04-530e5876a17mr2345669e87.44.1723130931412; Thu, 08 Aug 2024 08:28:51 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Erik Serrano Date: Thu, 8 Aug 2024 11:28:39 -0400 Message-ID: Subject: Re: Export Query Output to incremental csv file To: Ron Johnson Cc: Pgsql-admin Content-Type: multipart/alternative; boundary="000000000000118bb4061f2dafe4" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000118bb4061f2dafe4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Dear Sir, This was exactly what I needed, the idea was to do the incremental export in csv... of course I looked for some additional formats like "... stdout with (format csv)" and it worked perfectly. Thank you very much Ron for your help... A hug *Erik R. Serrano Saavedra* *Ingeniero de Sistemas Inform=C3=A1ticos* * Data Base Administrator* * eserranos@gmail.com * El jue, 8 ago 2024 a las 10:44, Ron Johnson () escribi=C3=B3: > On Thu, Aug 8, 2024 at 10:26=E2=80=AFAM Erik Serrano wrote: > >> Hi guys, >> I would like to ask a question about exporting a query output to a csv >> file but with the particularity that it is incremental (that is, the sam= e >> file grows in size) since I need to do the query multiple times and I do= n't >> want to fill up with csv files... but rather just one that always grows,= as >> if it were a log. >> >> I will add the query to a shell and schedule it using a crontab in Linux >> Centos. >> > > COPY ... TO STDOUT, and then append that to the CSV file using ">>". > > (Unless I misinterpret what you mean.) > > -- > Death to America, and butter sauce. > Iraq lobster! > --000000000000118bb4061f2dafe4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Dear Sir,

This was exactly what I needed, the idea = was to do the incremental export in csv... of course I looked for some addi= tional formats like "... stdout with (format csv)" and it worked = perfectly.

Thank you very much Ron for your help...
A hug


Erik R. Se= rrano Saavedra
In= geniero de Sistemas Inform=C3=A1ticos
=C2=A0 =C2=A0 =C2=A0 Data Base Administrator
=C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0eserranos@gmail.com
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0


El jue, 8 ago 2024 a= las 10:44, Ron Johnson (<ron= ljohnsonjr@gmail.com>) escribi=C3=B3:
On Thu, Aug = 8, 2024 at 10:26=E2=80=AFAM Erik Serrano <eserranos@gmail.com> wrote:
Hi guys,
I would like to ask a question about exporting a= query output to a csv file but with the particularity that it is increment= al (that is, the same file grows in size) since I need to do the query mult= iple times and I don't want to fill up with csv files... but rather jus= t one that always grows, as if it were a log.

I will add the query t= o a shell and schedule it using a crontab in Linux Centos.

COPY ... TO STDOUT, and then append that to the C= SV file using ">>".

(Unless I misi= nterpret what you mean.)

--
Death to America, and butter sauce.
Iraq lobster!
--000000000000118bb4061f2dafe4--