importing downloaded data

From: Sim Zacks <sim(at)compulab(dot)co(dot)il>
To: PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: importing downloaded data
Date: 2014-04-22 14:39:08
Message-ID: 53567F0C.8060605@compulab.co.il
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

<html style="direction: ltr;">
<head>

<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
</head>
<body style="direction: ltr;"
bidimailui-detected-decoding-type="latin-charset" bgcolor="#FFFFFF"
text="#000000">
Postgresql 9.3<br>
I am downloading data that I want to import into a table. The data
comes in tab delimited, CRLF format.<br>
I am using plpython to get the data and I wanted to use copy with
stdin to import it without having to save it to a file.<br>
To do this, I am setting sys.stdin to a StringIO object with my data
inside.<br>
<br>
However, when I call copy I am getting SPI_ERROR_COPY, which the
docs define as "if COPY TO stdout or COPY FROM stdin was attempted"&nbsp;
which is exactly what I am trying to do (so the error is logical).<br>
<br>
Is there another method of loading delimited data in bulk without
saving it as a file<span style="color: rgb(0, 0, 0); font-family:
verdana, sans-serif; font-size: 12.499999046325684px; font-style:
normal; font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: 18.240001678466797px; orphans: auto;
text-align: left; text-indent: 0px; text-transform: none;
white-space: normal; widows: auto; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); display: inline !important; float: none;">?<br>
<br>
Thanks<br>
Sim<br>
</span>
</body>
</html>

Attachment Content-Type Size
unknown_filename text/html 1.6 KB

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2014-04-22 14:39:13 Re: Is this a planner bug?
Previous Message Adrian Klaver 2014-04-22 14:32:10 Re: could not rename temporary statistics file "/run/shm/pgstat.tmp" to "/run/shm/pgstat.stat": No such file or directory