3030DEFAULT_TIMEOUT_SECONDS : int = 5
3131KEEPALIVE_FLAG : int = 1
3232KEEPIDLE_RATE : int = 60 # seconds
33- AUTH_CREDENTIALS_DEPRECATION_MESSAGE = """ Passing connection credentials directly to `connect` function is deprecated.
34- Please consider passing Auth object instead.
33+ AUTH_CREDENTIALS_DEPRECATION_MESSAGE = """ Passing connection credentials
34+ directly to the `connect` function is deprecated.
35+ Pass the `Auth` object instead.
3536 Examples:
3637 >>> from firebolt.client.auth import UsernamePassword
3738 >>> ...
@@ -128,29 +129,29 @@ def _get_auth(
128129 access_token : Optional [str ],
129130 use_token_cache : bool ,
130131) -> Auth :
131- """Create Auth class based on provided credentials.
132+ """Create ` Auth` class based on provided credentials.
132133
133- If access_token is provided, it's used for Auth creation.
134- Username and password are used otherwise .
134+ If ` access_token` is provided, it's used for ` Auth` creation.
135+ Otherwise, username/ password are used.
135136
136137 Returns:
137- Auth: auth object
138+ Auth: ` auth object`
138139
139140 Raises:
140- ConfigurationError: Invalid combination of credentials provided
141+ ` ConfigurationError` : Invalid combination of credentials provided
141142
142143 """
143144 if not access_token :
144145 if not username or not password :
145146 raise ConfigurationError (
146147 "Neither username/password nor access_token are provided. Provide one"
147- " to authenticate"
148+ " to authenticate. "
148149 )
149150 return UsernamePassword (username , password , use_token_cache )
150151 if username or password :
151152 raise ConfigurationError (
152- "Either username /password and access_token are provided. Provide only one"
153- " to authenticate"
153+ "Username /password and access_token are both provided. Provide only one"
154+ " to authenticate. "
154155 )
155156 return Token (access_token )
156157
@@ -172,24 +173,24 @@ async def connect_inner(
172173 """Connect to Firebolt database.
173174
174175 Args:
175- database (str): Name of the database to connect
176- username (Optional[str]): User name to use for authentication (Deprecated)
177- password (Optional[str]): Password to use for authentication (Deprecated)
178- access_token (Optional[str]): Authentication token to use insead of
176+ ` database` (str): Name of the database to connect
177+ ` username` (Optional[str]): User name to use for authentication (Deprecated)
178+ ` password` (Optional[str]): Password to use for authentication (Deprecated)
179+ ` access_token` (Optional[str]): Authentication token to use instead of
179180 credentials (Deprecated)
180- auth (Auth)L Authentication object
181- engine_name (Optional[str]): The name of the engine to connect to
182- engine_url (Optional[str]): The engine endpoint to use
183- account_name (Optional[str]): For customers with multiple accounts;
184- if None uses default.
185- api_endpoint (str): Firebolt API endpoint. Used for authentication.
186- use_token_cache (bool): Cached authentication token in filesystem.
181+ ` auth` (Auth)L Authentication object.
182+ ` engine_name` (Optional[str]): Name of the engine to connect to
183+ ` engine_url` (Optional[str]): The engine endpoint to use
184+ ` account_name` (Optional[str]): For customers with multiple accounts;
185+ if none, default is used
186+ ` api_endpoint` (str): Firebolt API endpoint. Used for authentication
187+ ` use_token_cache` (bool): Cached authentication token in filesystem
187188 Default: True
188- additional_parameters (Optional[Dict]): Dictionary of less widely-used
189- arguments for connection.
189+ ` additional_parameters` (Optional[Dict]): Dictionary of less widely-used
190+ arguments for connection
190191
191192 Note:
192- Providing both `engine_name` and `engine_url` would result in an error.
193+ Providing both `engine_name` and `engine_url` will result in an error
193194
194195 """
195196 # These parameters are optional in function signature
@@ -251,11 +252,12 @@ async def connect_inner(
251252
252253class OverriddenHttpBackend (AutoBackend ):
253254 """
254- This class is a short-term solution for TCP keep-alive issue:
255+ `OverriddenHttpBackend` is a short-term solution for the TCP
256+ connection idle timeout issue described in the following article:
255257 https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html#connection-idle-timeout
256- Since httpx creates a connection right before executing a request
257- backend has to be overridden in order to set the socket KEEPALIVE
258- and KEEPIDLE settings.
258+ Since httpx creates a connection right before executing a request, the
259+ backend must be overridden to set the socket to ` KEEPALIVE`
260+ and ` KEEPIDLE` settings.
259261 """
260262
261263 async def connect_tcp (
@@ -330,7 +332,7 @@ def _cursor(self, **kwargs: Any) -> BaseCursor:
330332 """
331333
332334 if self .closed :
333- raise ConnectionClosedError ("Unable to create cursor: connection closed" )
335+ raise ConnectionClosedError ("Unable to create cursor: connection closed. " )
334336
335337 c = self .cursor_class (self ._client , self , ** kwargs )
336338 self ._cursors .append (c )
@@ -354,7 +356,7 @@ async def _aclose(self) -> None:
354356
355357 @property
356358 def closed (self ) -> bool :
357- """True if connection is closed, False otherwise."""
359+ """` True if connection is closed; False otherwise."""
358360 return self ._is_closed
359361
360362 def _remove_cursor (self , cursor : Cursor ) -> None :
@@ -365,28 +367,28 @@ def _remove_cursor(self, cursor: Cursor) -> None:
365367 pass
366368
367369 def commit (self ) -> None :
368- """Does nothing since Firebolt doesn't have transactions"""
370+ """Does nothing since Firebolt doesn't have transactions. """
369371
370372 if self .closed :
371- raise ConnectionClosedError ("Unable to commit: connection closed" )
373+ raise ConnectionClosedError ("Unable to commit: Connection closed. " )
372374
373375
374376class Connection (BaseConnection ):
375377 """
376- Firebolt asyncronous database connection class. Implements `PEP 249`_.
378+ Firebolt asynchronous database connection class. Implements `PEP 249`_.
377379
378380 Args:
379- engine_url: Firebolt database engine REST API url
380- database: Firebolt database name
381- username: Firebolt account username
382- password: Firebolt account password
383- api_endpoint: Optional. Firebolt API endpoint. Used for authentication.
384- connector_versions: Optional. Tuple of connector name and version or
385- list of tuples of your connector stack. Useful for tracking custom
381+ ` engine_url` : Firebolt database engine REST API url
382+ ` database` : Firebolt database name
383+ ` username` : Firebolt account username
384+ ` password` : Firebolt account password
385+ ` api_endpoint` : Optional. Firebolt API endpoint used for authentication
386+ ` connector_versions` : Optional. Tuple of connector name and version, or
387+ a list of tuples of your connector stack. Useful for tracking custom
386388 connector usage.
387389
388390 Note:
389- Firebolt currenly doesn't support transactions
391+ Firebolt does not support transactions,
390392 so commit and rollback methods are not implemented.
391393
392394 .. _PEP 249:
@@ -406,7 +408,7 @@ def cursor(self) -> Cursor:
406408 # Context manager support
407409 async def __aenter__ (self ) -> Connection :
408410 if self .closed :
409- raise ConnectionClosedError ("Connection is already closed" )
411+ raise ConnectionClosedError ("Connection is already closed. " )
410412 return self
411413
412414 async def __aexit__ (
0 commit comments