Expose ReplicationMessage type in extras

This commit is contained in:
Oleksandr Shulgin 2015-06-11 12:20:52 +02:00
parent 9fc5bf4436
commit 35a3262fe3
3 changed files with 5 additions and 3 deletions

View File

@ -56,7 +56,7 @@ try:
except ImportError:
pass
from psycopg2._psycopg import adapt, adapters, encodings, connection, cursor, lobject, Xid
from psycopg2._psycopg import adapt, adapters, encodings, connection, cursor, replicationMessage, lobject, Xid
from psycopg2._psycopg import string_types, binary_types, new_type, new_array_type, register_type
from psycopg2._psycopg import ISQLQuote, Notify, Diagnostics, Column

View File

@ -39,6 +39,7 @@ import psycopg2
from psycopg2 import extensions as _ext
from psycopg2.extensions import cursor as _cursor
from psycopg2.extensions import connection as _connection
from psycopg2.extensions import replicationMessage as ReplicationMessage
from psycopg2.extensions import adapt as _A
from psycopg2.extensions import b
@ -515,13 +516,13 @@ class ReplicationCursor(_cursor):
else:
raise RuntimeError("unrecognized replication slot type")
return self.execute(command)
self.execute(command)
def drop_replication_slot(self, slot_name):
"""Drop streaming replication slot."""
command = "DROP_REPLICATION_SLOT %s" % self.quote_ident(slot_name)
return self.execute(command)
self.execute(command)
def start_replication(self, o, slot_type, slot_name=None, start_lsn=None,
timeline=0, keepalive_interval=10, options=None):

View File

@ -911,6 +911,7 @@ INIT_MODULE(_psycopg)(void)
/* put new types in module dictionary */
PyModule_AddObject(module, "connection", (PyObject*)&connectionType);
PyModule_AddObject(module, "cursor", (PyObject*)&cursorType);
PyModule_AddObject(module, "replicationMessage", (PyObject*)&replicationMessageType);
PyModule_AddObject(module, "ISQLQuote", (PyObject*)&isqlquoteType);
PyModule_AddObject(module, "Notify", (PyObject*)&notifyType);
PyModule_AddObject(module, "Xid", (PyObject*)&xidType);