MCPcopy Index your code
hub / github.com/MagicStack/asyncpg / _detect_server_capabilities

Function _detect_server_capabilities

asyncpg/connection.py:2676–2722  ·  view source on GitHub ↗
(server_version, connection_settings)

Source from the content-addressed store, hash-verified

2674
2675
2676def _detect_server_capabilities(server_version, connection_settings):
2677 if hasattr(connection_settings, 'padb_revision'):
2678 # Amazon Redshift detected.
2679 advisory_locks = False
2680 notifications = False
2681 plpgsql = False
2682 sql_reset = True
2683 sql_close_all = False
2684 jit = False
2685 sql_copy_from_where = False
2686 elif hasattr(connection_settings, 'crdb_version'):
2687 # CockroachDB detected.
2688 advisory_locks = False
2689 notifications = False
2690 plpgsql = False
2691 sql_reset = False
2692 sql_close_all = False
2693 jit = False
2694 sql_copy_from_where = False
2695 elif hasattr(connection_settings, 'crate_version'):
2696 # CrateDB detected.
2697 advisory_locks = False
2698 notifications = False
2699 plpgsql = False
2700 sql_reset = False
2701 sql_close_all = False
2702 jit = False
2703 sql_copy_from_where = False
2704 else:
2705 # Standard PostgreSQL server assumed.
2706 advisory_locks = True
2707 notifications = True
2708 plpgsql = True
2709 sql_reset = True
2710 sql_close_all = True
2711 jit = server_version >= (11, 0)
2712 sql_copy_from_where = server_version.major >= 12
2713
2714 return ServerCapabilities(
2715 advisory_locks=advisory_locks,
2716 notifications=notifications,
2717 plpgsql=plpgsql,
2718 sql_reset=sql_reset,
2719 sql_close_all=sql_close_all,
2720 sql_copy_from_where=sql_copy_from_where,
2721 jit=jit,
2722 )
2723
2724
2725def _extract_stack(limit=10):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…