Skip to content

QuestDB support #1260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion asyncpg/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ def __init__(self, protocol, transport, loop,
self._server_caps = _detect_server_capabilities(
self._server_version, settings)

self._protocol.get_settings().register_data_types(self._server_caps.extra_types)

if self._server_version < (14, 0):
self._intro_query = introspection.INTRO_LOOKUP_TYPES_13
else:
Expand Down Expand Up @@ -2654,7 +2656,7 @@ class _ConnectionProxy:
ServerCapabilities = collections.namedtuple(
'ServerCapabilities',
['advisory_locks', 'notifications', 'plpgsql', 'sql_reset',
'sql_close_all', 'sql_copy_from_where', 'jit'])
'sql_close_all', 'sql_copy_from_where', 'jit', 'extra_types'])
ServerCapabilities.__doc__ = 'PostgreSQL server capabilities.'


Expand All @@ -2668,6 +2670,7 @@ def _detect_server_capabilities(server_version, connection_settings):
sql_close_all = False
jit = False
sql_copy_from_where = False
extra_types = []
elif hasattr(connection_settings, 'crdb_version'):
# CockroachDB detected.
advisory_locks = False
Expand All @@ -2677,6 +2680,7 @@ def _detect_server_capabilities(server_version, connection_settings):
sql_close_all = False
jit = False
sql_copy_from_where = False
extra_types = []
elif hasattr(connection_settings, 'crate_version'):
# CrateDB detected.
advisory_locks = False
Expand All @@ -2686,6 +2690,29 @@ def _detect_server_capabilities(server_version, connection_settings):
sql_close_all = False
jit = False
sql_copy_from_where = False
extra_types = []
elif hasattr(connection_settings, 'questdb_version'):
# QuestDB detected.
advisory_locks = False
notifications = False
plpgsql = False
sql_reset = False
sql_close_all = False
jit = False
sql_copy_from_where = False
extra_types = [{
'oid': 1022,
'elemtype': 701,
'kind': 'b',
'name': '_float8',
'elemtype_name': 'float8',
'ns': 'pg_catalog',
'elemdelim': ',',
'depth': 0,
'range_subtype': None,
'attrtypoids': None,
'basetype': None
}]
else:
# Standard PostgreSQL server assumed.
advisory_locks = True
Expand All @@ -2695,6 +2722,7 @@ def _detect_server_capabilities(server_version, connection_settings):
sql_close_all = True
jit = server_version >= (11, 0)
sql_copy_from_where = server_version.major >= 12
extra_types = []

return ServerCapabilities(
advisory_locks=advisory_locks,
Expand All @@ -2704,6 +2732,7 @@ def _detect_server_capabilities(server_version, connection_settings):
sql_close_all=sql_close_all,
sql_copy_from_where=sql_copy_from_where,
jit=jit,
extra_types=extra_types
)


Expand Down