def initialize(self, namespace_schemas): self._namespace_schemas = namespace_schemas self._sql_builder = sql.SQLBuilder(self._namespace_schemas, self._type_map(), self._rewriter_table(), self._table_name, self._placeholder, self._placeholder, self._rewriter_property)
def __init__(self, connection_string="", table_prefix="", library="psycopg2"): self._connection = PostgresqlConnection(connection_string, library) self._library = library if table_prefix and not re.match(r"[a-z][_a-z]*(\.[a-z][_a-z]*)*", table_prefix): raise ValueError("invalid table_prefix %s" % table_prefix) self._table_prefix = table_prefix self._core_table_name = self._table_name("core") self._link_table_name = self._table_name("link") self._tag_table_name = self._table_name("tag") self._namespace_schemas = {} self._sql_builder = sql.SQLBuilder({}, sql.TypeMap(), {}, self._table_name, self._placeholder, self._placeholder, self._rewriter_property)
def __init__(self, connection_string="", mod_spatialite_path="mod_spatialite", table_prefix=""): dbapi2.register_converter("BOOLEAN", lambda x: bool(int(x))) dbapi2.register_adapter(bool, lambda x: int(x)) dbapi2.register_converter("UUID", lambda x: uuid.UUID(x.decode())) dbapi2.register_adapter(uuid.UUID, lambda x: x.hex) dbapi2.register_converter("GEOMETRY", _cast_geometry) dbapi2.register_adapter(geometry.Point, _adapt_geometry) dbapi2.register_adapter(geometry.LineString, _adapt_geometry) dbapi2.register_adapter(geometry.Polygon, _adapt_geometry) dbapi2.register_adapter(geometry.MultiPoint, _adapt_geometry) dbapi2.register_adapter(geometry.MultiLineString, _adapt_geometry) dbapi2.register_adapter(geometry.MultiPolygon, _adapt_geometry) self._connection_string = connection_string self._connection = SQLiteConnection(connection_string, mod_spatialite_path, self) if table_prefix and not re.match(r"[a-z][_a-z]*(\.[a-z][_a-z]*)*", table_prefix): raise ValueError("invalid table_prefix %s" % table_prefix) self._table_prefix = table_prefix self._core_table_name = self._table_name("core") self._link_table_name = self._table_name("link") self._tag_table_name = self._table_name("tag") self._namespace_schemas = {} self._sql_builder = sql.SQLBuilder({}, sql.TypeMap(), {}, self._table_name, self._placeholder, self._placeholder, self._rewriter_property)