File: multicorn.md

package info (click to toggle)
postgresql-multicorn 1.0.4-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 864 kB
  • ctags: 611
  • sloc: ansic: 2,690; python: 1,829; sql: 645; makefile: 93; sh: 29
file content (71 lines) | stat: -rwxr-xr-x 1,672 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
Multicorn
=========

Synopsis
--------

Multicorn is a PostgreSQL 9.2+ extension allowing to write Foreign Data Wrappers
in python.
It is bundled with some foreign data wrappers.

*More comprehensive documentation can be found at http://multicorn.org*

Usage
-----

Create the extension (as a super user, on your target database):


    CREATE EXTENSION multicorn;



Define a foreign server for the specific python foreign data wrappers you want
to use:



    CREATE SERVER my_server_name FOREIGN DATA WRAPPER multicorn
    options (
        wrapper 'python.class.Name'
    )


Where *python.class.Name* is a string defining which foreign data wrapper class
to use.

Ex, for the Imap foreign data wrapper:



    CREATE SERVER multicorn_imap FOREIGN DATA WRAPPER multicorn
        options (
        wrapper 'multicorn.imapfdw.ImapFdw'
    );


Once you have a server set up, you can create foreign tables on your server.

The foreign table must be supplied its required options.

Ex:



    create foreign table gmail (                                                                 
        "Message-ID" character varying,
        "From" character varying,
        "Subject" character varying,
        "payload" character varying,
        "flags" character varying[],
        "To" character varying) server multicorn_imap options (
            host 'imap.gmail.com',
            port '465', 
            payload_column 'payload', 
            flags_column 'flags',
            ssl 'True',
            login 'mylogin', 
            password 'mypassword'
    );

For a documentation on the existing foreign data wrappers, see http://multicorn.org/foreign-data-wrappers/