[Info-ingres] COPY command support
Chris Clark
Chris.Clark at actian.com
Wed Mar 9 23:39:13 UTC 2016
I can confirm that the driver uses ODBC and so does not have access to libq functionality.
You can hook up to something like PrettyTable, or a two liner using the stdlib csv module. I would avoid manually doing the formatting yourself. If you really need copy table functionality/formatting then shelling out via subprocess is worth looking at.
As a side note, if it were me I'd consider using the pyodbc (or pypyodbc) driver instead. It won't give you copy table support but you don't have to build them to get access to Ingres, unlike ingresdbi.
Chris
-----Original Message-----
From: info-ingres-bounces at lists.planetingres.org [mailto:info-ingres-bounces at lists.planetingres.org] On Behalf Of Karl Schendel
Sent: Tuesday, March 08, 2016 7:06 PM
To: pwhite peercore <pwhite at peercore.com.au>
Cc: Ingres and related product discussion forum <info-ingres at lists.planetingres.org>
Subject: Re: [Info-ingres] COPY command support
I suspect that the issue is running via DBI. COPY depends on a very tight coupling between server and client, and requires a lot of client side support.
It's really only supported from LIBQ (ie, embedded SQL library), although with enough code one can make it work via the OpenAPI as well.
I don't know what DBI uses but it's probably impractical to implement a COPY with it. The best bet is to run select retrievals and do a bit of formatting once the rows come out of dbi.
Karl
> On Mar 8, 2016, at 6:39 PM, pwhite peercore <pwhite at peercore.com.au> wrote:
>
> Hi Saumya,
>
> What operating system are you running?
>
> The copy statement was working fine in Ingres 2.0
>
> Please try running copydb from the operating system command prompt.
>
> copydb mydb mytable
> or
> copydb -c mydb mytable
>
> This generates two files copy.in and copy.out which you then use to
> import and export data from the database.
> Both copy.in and copy.out contain examples of the copy statement.
>
> See simple example here:
> http://en.allexperts.com/q/Ingres-3317/Ingres-flat-files-unix.htm
>
> Paul
>
>
>
> -----Original Message-----
> From: info-ingres-bounces at lists.planetingres.org
> [mailto:info-ingres-bounces at lists.planetingres.org] On Behalf Of
> saumya saxena
> Sent: Wednesday, 9 March 2016 12:56 AM
> To: info-ingres at lists.planetingres.org
> Subject: [Info-ingres] COPY command support
>
> Hi experts,
>
> I'm using ingresdbi2.0 for executing queries. I have a requirement of
> executing COPY command to dump the table data to flat file. But found
> there is no support for it, please advice what can be done for it ?
>
> Thanks,
> Saumya
> _______________________________________________
> Info-ingres mailing list
> Info-ingres at lists.planetingres.org
> http://lists.planetingres.org/mailman/listinfo/info-ingres
>
> _______________________________________________
> Info-ingres mailing list
> Info-ingres at lists.planetingres.org
> http://lists.planetingres.org/mailman/listinfo/info-ingres
_______________________________________________
Info-ingres mailing list
Info-ingres at lists.planetingres.org
http://lists.planetingres.org/mailman/listinfo/info-ingres
More information about the Info-ingres
mailing list