MCPcopy
hub / github.com/psycopg/psycopg / get_py_multiranges

Function get_py_multiranges

tools/update_oids.py:192–210  ·  view source on GitHub ↗
(conn: Connection)

Source from the content-addressed store, hash-verified

190
191
192def get_py_multiranges(conn: Connection) -> list[str]:
193 lines = []
194 for typname, oid, typarray, rngtypid, rngsubtype in conn.execute("""
195select typname, oid, typarray, rngtypid, rngsubtype
196from
197 pg_type t
198 join pg_range r on t.oid = rngmultitypid
199where
200 oid < 10000
201 and typtype = 'm'
202order by typname
203"""):
204 params = [
205 f"{typname!r}, {oid}, {typarray},"
206 f" range_oid={rngtypid}, subtype_oid={rngsubtype}"
207 ]
208 lines.append(f"MultirangeInfo({','.join(params)}),")
209
210 return lines
211
212
213def get_cython_oids(conn: Connection) -> list[str]:

Callers 1

update_python_typesFunction · 0.85

Calls 2

executeMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected