Skip to content

Kozea/sqlalchemy_fdw

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 

sqlalchemy_fdw is a postgresql dialect for sqlalchemy adding support for foreign data wrappers.

Installation

pip install sqlalchemy-fdw

Usage

from sqlalchemy import create_engine, Table, Column, MetaData
from sqlalchemy import Integer, Unicode
from sqlalchemy_fdw import ForeignTable, ForeignDataWrapper


engine = create_engine('pgfdw://user:password@host:port/dbname')
metadata = MetaData()
metadata.bind = engine

fdw = ForeignDataWrapper("myfdwserver", "myfdwextension", metadata=metadata,
                            options={'option1': 'test'})
fdw.create()

table = ForeignTable("myforeigntable", metadata,
            Column('col1', Integer),
            Column('col2', Unicode),
            pgfdw_server='myfdwserver',
            pgfdw_options={
                'tableoption': 'optionvalue'
            }
        )
table.create(checkfirst=True)
table.drop()
fdw.drop(cascade=True)

About

A postgresql dialect based on psycopg2 adding support for Foreign Data Wrappers

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Languages