1818 Protocol , Tuple , runtime_checkable )
1919
2020from aws_advanced_python_wrapper .driver_info import DriverInfo
21+ from aws_advanced_python_wrapper .utils .rds_url_type import RdsUrlType
2122
2223if TYPE_CHECKING :
2324 from aws_advanced_python_wrapper .pep249 import Connection
@@ -98,6 +99,15 @@ def is_reader_query(self) -> str:
9899 return self ._IS_READER_QUERY
99100
100101
102+ @runtime_checkable
103+ class AuroraLimitlessDialect (Protocol ):
104+ _LIMITLESS_ROUTER_ENDPOINT_QUERY : str
105+
106+ @property
107+ def limitless_router_endpoint_query (self ) -> str :
108+ return self ._LIMITLESS_ROUTER_ENDPOINT_QUERY
109+
110+
101111class DatabaseDialect (Protocol ):
102112 """
103113 Database dialects help the AWS Advanced Python Driver determine what kind of underlying database is being used,
@@ -342,7 +352,7 @@ def get_host_list_provider_supplier(self) -> Callable:
342352 return lambda provider_service , props : RdsHostListProvider (provider_service , props )
343353
344354
345- class AuroraPgDialect (PgDatabaseDialect , TopologyAwareDatabaseDialect ):
355+ class AuroraPgDialect (PgDatabaseDialect , TopologyAwareDatabaseDialect , AuroraLimitlessDialect ):
346356 _DIALECT_UPDATE_CANDIDATES : Tuple [DialectCode , ...] = (DialectCode .MULTI_AZ_PG ,)
347357
348358 _EXTENSIONS_QUERY = "SELECT (setting LIKE '%aurora_stat_utils%') AS aurora_stat_utils " \
@@ -359,6 +369,7 @@ class AuroraPgDialect(PgDatabaseDialect, TopologyAwareDatabaseDialect):
359369
360370 _HOST_ID_QUERY = "SELECT aurora_db_instance_identifier()"
361371 _IS_READER_QUERY = "SELECT pg_is_in_recovery()"
372+ _LIMITLESS_ROUTER_ENDPOINT_QUERY = "SELECT router_endpoint, load FROM aurora_limitless_router_endpoints()"
362373
363374 @property
364375 def dialect_update_candidates (self ) -> Optional [Tuple [DialectCode , ...]]:
@@ -621,6 +632,11 @@ def get_dialect(self, driver_dialect: str, props: Properties) -> DatabaseDialect
621632
622633 if target_driver_type is TargetDriverType .POSTGRES :
623634 rds_type = self ._rds_helper .identify_rds_type (host )
635+ if rds_type == RdsUrlType .RDS_AURORA_LIMITLESS_DB_SHARD_GROUP :
636+ self ._can_update = False
637+ self ._dialect_code = DialectCode .AURORA_PG
638+ self ._dialect = DatabaseDialectManager ._known_dialects_by_code [DialectCode .AURORA_PG ]
639+ return self ._dialect
624640 if rds_type .is_rds_cluster :
625641 self ._can_update = True
626642 self ._dialect_code = DialectCode .AURORA_PG
0 commit comments