[Bucardo-general] customselect for trasforming column names for table synced from PostgreSQL to Mongo

Ali Asad Lotia ali at anobii.com
Mon May 7 19:31:50 UTC 2012

On 7 May 2012 18:17, Greg Sabino Mullane <greg at endpoint.com> wrote:
> On Sun, May 06, 2012 at 07:04:31PM +0100, Ali Asad Lotia wrote:
>> Hi All,
>> I will be syncing a table between PostgreSQL and MongoDB and want to
>> map the PostgreSQL column names in certain tables to other key names
>> in Mongo documents. Is this doable using a custom select where the
>> select does something like:
>> SELECT foo as bar
>> Assuming this works, I would expect the MongoDB document to contain a
>> key bar with the value of the orginal column foo.
> Correct.
>> If this is possible, I would much appreciate pointers to documentation
>> on how to write custom selects and the steps required to get them
>> loaded into a bucardo set up.
> The test file t/20-postgres.t has a working example: grep for 'customcols'
> The basic idea is to replace the default 'SELECT * FROM table' with a modified
> select list, by calling:
> $ bucardo add customcols mytable "SELECT a,b, foo AS bar"
> You can optionally constrain to a certain sync:
> $ bucardo add customcols mytable "SELECT a,b, foo AS bar" sync=mysync
> And/or to a certain database (which is probably what you want to do here):
> $ bucardo add customcols mytable "SELECT a,b, foo AS bar" db=mymongodb
> Docs are definitely lacking here. At the very least, I should get a
> blog post out explaining it in more detail.

Thanks much for the reply Greg. I noticed that the docs are available
in a wiki on the Endpoint site. In the process of investigating
Bucardo for our needs, I may be able to pad out the docs. How does one
obtain write access to the wiki and what sort of wiki is it so I can
get acquainted with the wiki markup.

More information about the Bucardo-general mailing list