@@ -183,9 +183,10 @@ def __eq__(self, other: Any) -> bool:
183183
184184
185185def connect (
186- driver : Union [str , pathlib .Path ],
186+ driver : Optional [ Union [str , pathlib .Path ]] = None ,
187187 uri : Optional [str ] = None ,
188188 * ,
189+ profile : Optional [str ] = None ,
189190 entrypoint : Optional [str ] = None ,
190191 db_kwargs : Optional [Dict [str , Union [str , pathlib .Path ]]] = None ,
191192 conn_kwargs : Optional [Dict [str , str ]] = None ,
@@ -217,10 +218,17 @@ def connect(
217218 where the scheme happens to be the same as the driver name (so
218219 PostgreSQL works, but not SQLite, for example, as SQLite uses
219220 ``file:`` URIs).
221+
222+ - If the URI begins with ``profile://``, then a connection profile
223+ will be loaded instead. See :doc:`/format/connection_profiles`.
220224 uri
221225 The "uri" parameter to the database (if applicable). This is
222226 equivalent to passing it in ``db_kwargs`` but is slightly cleaner.
223227 If given, takes precedence over any value in ``db_kwargs``.
228+ profile
229+ A connection profile to load. Loading ``profile="profile-name"`` is
230+ the same as loading the URI ``profile://profile-name``. See
231+ :doc:`/format/connection_profiles`.
224232 entrypoint
225233 The driver-specific entrypoint, if different than the default.
226234 db_kwargs
@@ -238,16 +246,22 @@ def connect(
238246 conn = None
239247
240248 db_kwargs = dict (db_kwargs or {})
241- db_kwargs ["driver" ] = driver
249+ if driver :
250+ db_kwargs ["driver" ] = driver
242251 if uri :
243252 db_kwargs ["uri" ] = uri
244253 if entrypoint :
245254 db_kwargs ["entrypoint" ] = entrypoint
255+ if profile :
256+ db_kwargs ["profile" ] = profile
246257 if conn_kwargs is None :
247258 conn_kwargs = {}
248259 # N.B. treating uri = "postgresql://..." as driver = "postgresql", uri =
249260 # "..." is handled at the C driver manager layer
250261
262+ if all (k not in db_kwargs for k in ("driver" , "uri" , "profile" )):
263+ raise TypeError ("Must specify at least one of 'driver', 'uri', or 'profile'" )
264+
251265 try :
252266 db = _lib .AdbcDatabase (** db_kwargs )
253267 conn = _lib .AdbcConnection (db , ** conn_kwargs )
0 commit comments