Thread: PostgreSql Doubt

PostgreSql Doubt

From
aluka raju
Date:
Hello,

I have a data source for example in file format(xml,csv ..etc) , i want to use postgresql engine to query select,update,insert using foreign data wrappers(fdw).

question1 --- > is it possible to prepare our own fdw ?. 
question2 -----> is it possible to seperate postgresql engine and use it on a data source where i will write fdw to connect the postgresql engine and data source ?.
question3 -----> In fdw , we need to provide schema of the file , suppose i will get schema of the file in a varaible and how can we use this variable and directly create a link between datasource and postgresql engine ?.


question4 -----> is this fdw(foreign data wrapper) good to use in postgresql ,if so did postgresql prepaired any api kind of fdw officially  ?

Thanks
aluka

Re: PostgreSql Doubt

From
Adrian Klaver
Date:
On 05/21/2016 02:22 PM, aluka raju wrote:
> Hello,
>
> I have a data source for example in file format(xml,csv ..etc) , i want
> to use postgresql engine to query select,update,insert using foreign
> data wrappers(fdw).
>
> question1 --- > is it possible to prepare our own fdw ?.

http://www.postgresql.org/docs/9.5/static/fdwhandler.html

> question2 -----> is it possible to seperate postgresql engine and use it
> on a data source where i will write fdw to connect the postgresql engine
> and data source ?.

No.

> question3 -----> In fdw , we need to provide schema of the file ,
> suppose i will get schema of the file in a varaible and how can we use
> this variable and directly create a link between datasource and
> postgresql engine ?.

You will need to be more specific about what you mean here?

>
>
> question4 -----> is this fdw(foreign data wrapper) good to use in
> postgresql ,if so did postgresql prepaired any api kind of fdw officially  ?

If I am following then the link at question 1 should address this. If I
am not you will need to be provide more information about what you are
looking for.

>
> Thanks
> aluka


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: PostgreSql Doubt

From
John R Pierce
Date:
On 5/21/2016 2:22 PM, aluka raju wrote:

I have a data source for example in file format(xml,csv ..etc) , i want to use postgresql engine to query select,update,insert using foreign data wrappers(fdw).

updating/inserting into a CSV, XML, or whatever flat file will be very painful, it will require copying the whole file with the new/changed record in place.


I would recommend instead importing your XML/CSV/etc data into SQL table(s), do your data operations there, then export the results back as XML or whatever if you really need it that way.



-- 
john r pierce, recycling bits in santa cruz