Skip to content

Commit 473ab9c

Browse files
committed
refactor(Connection): alphabetize setting definitions
1 parent 3458432 commit 473ab9c

File tree

2 files changed

+109
-109
lines changed

2 files changed

+109
-109
lines changed

redshift_connector/__init__.py

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -262,52 +262,52 @@ def connect(
262262
A Connection object associated with the specified Amazon Redshift cluster: :class:`Connection`
263263
"""
264264
info: RedshiftProperty = RedshiftProperty()
265-
info.put("user_name", user)
266-
info.put("host", host)
267-
info.put("db_name", database)
268-
info.put("port", port)
269-
info.put("password", password)
270-
info.put("source_address", source_address)
271-
info.put("unix_sock", unix_sock)
272-
info.put("ssl", ssl)
273-
info.put("sslmode", sslmode)
274-
info.put("timeout", timeout)
275-
info.put("max_prepared_statements", max_prepared_statements)
276-
info.put("tcp_keepalive", tcp_keepalive)
277-
info.put("application_name", application_name)
278-
info.put("replication", replication)
279-
info.put("idp_host", idp_host)
280-
info.put("db_user", db_user)
265+
info.put("access_key_id", access_key_id)
266+
info.put("allow_db_user_override", allow_db_user_override)
281267
info.put("app_id", app_id)
282268
info.put("app_name", app_name)
283-
info.put("preferred_role", preferred_role)
284-
info.put("principal", principal_arn)
285-
info.put("access_key_id", access_key_id)
286-
info.put("secret_access_key", secret_access_key)
287-
info.put("session_token", session_token)
288-
info.put("profile", profile)
289-
info.put("credentials_provider", credentials_provider)
290-
info.put("region", region)
291-
info.put("cluster_identifier", cluster_identifier)
292-
info.put("iam", iam)
269+
info.put("application_name", application_name)
270+
info.put("auto_create", auto_create)
293271
info.put("client_id", client_id)
294-
info.put("idp_tenant", idp_tenant)
272+
info.put("client_protocol_version", client_protocol_version)
295273
info.put("client_secret", client_secret)
296-
info.put("partner_sp_id", partner_sp_id)
274+
info.put("cluster_identifier", cluster_identifier)
275+
info.put("credentials_provider", credentials_provider)
276+
info.put("database_metadata_current_db_only", database_metadata_current_db_only)
277+
info.put("db_groups", db_groups)
278+
info.put("db_name", database)
279+
info.put("db_user", db_user)
280+
info.put("force_lowercase", force_lowercase)
281+
info.put("host", host)
282+
info.put("iam", iam)
283+
info.put("iam_disable_cache", iam_disable_cache)
284+
info.put("idp_host", idp_host)
297285
info.put("idp_response_timeout", idp_response_timeout)
286+
info.put("idp_tenant", idp_tenant)
298287
info.put("listen_port", listen_port)
299288
info.put("login_url", login_url)
300-
info.put("auto_create", auto_create)
301-
info.put("db_groups", db_groups)
302-
info.put("force_lowercase", force_lowercase)
303-
info.put("allow_db_user_override", allow_db_user_override)
304-
info.put("client_protocol_version", client_protocol_version)
305-
info.put("database_metadata_current_db_only", database_metadata_current_db_only)
289+
info.put("max_prepared_statements", max_prepared_statements)
290+
info.put("partner_sp_id", partner_sp_id)
291+
info.put("password", password)
292+
info.put("port", port)
293+
info.put("preferred_role", preferred_role)
294+
info.put("principal", principal_arn)
295+
info.put("profile", profile)
296+
info.put("region", region)
297+
info.put("replication", replication)
298+
info.put("role_arn", role_arn)
299+
info.put("role_session_name", role_session_name)
300+
info.put("secret_access_key", secret_access_key)
301+
info.put("session_token", session_token)
302+
info.put("source_address", source_address)
303+
info.put("ssl", ssl)
306304
info.put("ssl_insecure", ssl_insecure)
305+
info.put("sslmode", sslmode)
306+
info.put("tcp_keepalive", tcp_keepalive)
307+
info.put("timeout", timeout)
308+
info.put("unix_sock", unix_sock)
309+
info.put("user_name", user)
307310
info.put("web_identity_token", web_identity_token)
308-
info.put("role_session_name", role_session_name)
309-
info.put("role_arn", role_arn)
310-
info.put("iam_disable_cache", iam_disable_cache)
311311

312312
_logger.debug(make_divider_block())
313313
_logger.debug("User provided connection arguments")

redshift_connector/redshift_property.py

Lines changed: 72 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -9,100 +9,100 @@ def __init__(self: "RedshiftProperty", **kwargs):
99
Initialize a RedshiftProperty object.
1010
"""
1111
if len(kwargs) == 0:
12-
self.iam: bool = False
13-
# The IdP (identity provider) host you are using to authenticate into Redshift.
14-
self.idp_host: typing.Optional[str] = None
15-
# The port used by an IdP (identity provider).
16-
self.idpPort: int = 443
17-
# The length of time, in seconds
18-
self.duration: int = 900
19-
# The IAM role you want to assume during the connection to Redshift.
20-
self.preferred_role: typing.Optional[str] = None
21-
# The Amazon Resource Name (ARN) of the SAML provider in IAM that describes the IdP.
22-
self.principal: typing.Optional[str] = None
23-
# This property indicates whether the IDP hosts server certificate should be verified.
24-
self.ssl_insecure: bool = True
25-
# The Okta-provided unique ID associated with your Redshift application.
26-
self.app_id: typing.Optional[str] = None
27-
# The name of the Okta application that you use to authenticate the connection to Redshift.
28-
self.app_name: str = "amazon_aws_redshift"
2912
# The access key for the IAM role or IAM user configured for IAM database authentication
3013
self.access_key_id: typing.Optional[str] = None
31-
# The secret access key for the IAM role or IAM user configured for IAM database authentication
32-
self.secret_access_key: typing.Optional[str] = None
33-
# session_token is required only for an IAM role with temporary credentials.
34-
# session_token is not used for an IAM user.
35-
self.session_token: typing.Optional[str] = None
36-
# The name of a profile in a AWS credentials or config file that contains values for connection options
37-
self.profile: typing.Optional[str] = None
38-
# The class path to a specific credentials provider plugin class.
39-
self.credentials_provider: typing.Optional[str] = None
40-
# A comma-separated list of existing database group names that the DbUser joins for the current session.
41-
# If not specified, defaults to PUBLIC.
42-
self.db_groups: typing.List[str] = list()
43-
# Forces the database group names to be lower case.
44-
self.force_lowercase: bool = False
4514
# This option specifies whether the driver uses the DbUser value from the SAML assertion
4615
# or the value that is specified in the DbUser connection property in the connection URL.
4716
self.allow_db_user_override: bool = False
48-
# Indicates whether the user should be created if not exists.
17+
# The Okta-provided unique ID associated with your Redshift application.
18+
self.app_id: typing.Optional[str] = None
19+
# The name of the Okta application that you use to authenticate the connection to Redshift.
20+
self.app_name: str = "amazon_aws_redshift"
21+
self.application_name: typing.Optional[str] = None
22+
# Indicates whether the user should be created if it does not already exist.
4923
self.auto_create: bool = False
50-
# The AWS region where the cluster specified by m_cluster_identifier is located.
51-
self.region: typing.Optional[str] = None
52-
# The name of the Redshift Cluster to use.
53-
self.cluster_identifier: typing.Optional[str] = None
5424
# The client ID associated with the user name in the Azure AD portal. Only used for Azure AD.
5525
self.client_id: typing.Optional[str] = None
56-
# The Azure AD tenant ID for your Redshift application.Only used for Azure AD.
57-
self.idp_tenant: typing.Optional[str] = None
26+
# client's requested transfer protocol version. See config.py for supported protocols
27+
self.client_protocol_version: int = DEFAULT_PROTOCOL_VERSION
5828
# The client secret as associated with the client ID in the AzureAD portal. Only used for Azure AD.
5929
self.client_secret: typing.Optional[str] = None
60-
# The user ID to use with your Redshift account.
61-
self.db_user: typing.Optional[str] = None
62-
# The host to connect to.
63-
self.host: str = ""
30+
# The name of the Redshift Cluster to use.
31+
self.cluster_identifier: typing.Optional[str] = None
32+
# The class path to a specific credentials provider plugin class.
33+
self.credentials_provider: typing.Optional[str] = None
34+
# Boolean indicating if application supports multidatabase datashare catalogs.
35+
# Default value of True indicates the application is does not support multidatabase datashare
36+
# catalogs for backwards compatibility.
37+
self.database_metadata_current_db_only: bool = True
38+
# A list of existing database group names that the DbUser joins for the current session.
39+
# If not specified, defaults to PUBLIC.
40+
self.db_groups: typing.List[str] = list()
6441
# database name
6542
self.db_name: str = ""
66-
# The port to connect to.
67-
self.port: int = 5439
6843
# The user name.
69-
self.user_name: str = ""
44+
self.db_user: typing.Optional[str] = None
45+
# The length of time, in seconds
46+
self.duration: int = 900
47+
# Forces the database group names to be lower case.
48+
self.force_lowercase: bool = False
49+
# The host to connect to.
50+
self.host: str = ""
51+
self.iam: bool = False
52+
self.iam_disable_cache: bool = False
53+
# The IdP (identity provider) host you are using to authenticate into Redshift.
54+
self.idp_host: typing.Optional[str] = None
55+
# timeout for authentication via Browser IDP
56+
self.idp_response_timeout: int = 120
57+
# The Azure AD tenant ID for your Redshift application.Only used for Azure AD.
58+
self.idp_tenant: typing.Optional[str] = None
59+
# The port used by an IdP (identity provider).
60+
self.idpPort: int = 443
61+
self.listen_port: int = 7890
62+
self.login_url: typing.Optional[str] = None
63+
# max number of prepared statements
64+
self.max_prepared_statements: int = 1000
65+
# parameter for PingIdentity
66+
self.partner_sp_id: typing.Optional[str] = None
7067
# The password.
7168
self.password: str = ""
72-
# The source IP address which initiates the connection to the PostgreSQL server.
69+
# The port to connect to.
70+
self.port: int = 5439
71+
# The IAM role you want to assume during the connection to Redshift.
72+
self.preferred_role: typing.Optional[str] = None
73+
# The Amazon Resource Name (ARN) of the SAML provider in IAM that describes the IdP.
74+
self.principal: typing.Optional[str] = None
75+
# The name of a profile in a AWS credentials or config file that contains values for connection options
76+
self.profile: typing.Optional[str] = None
77+
# The AWS region where the cluster specified by cluster_identifier is located.
78+
self.region: typing.Optional[str] = None
79+
# Used to run in streaming replication mode. If your server character encoding is not ascii or utf8,
80+
# then you need to provide values as bytes
81+
self.replication: typing.Optional[str] = None
82+
self.role_arn: typing.Optional[str] = None
83+
self.role_session_name: typing.Optional[str] = None
84+
# The secret access key for the IAM role or IAM user configured for IAM database authentication
85+
self.secret_access_key: typing.Optional[str] = None
86+
# session_token is required only for an IAM role with temporary credentials.
87+
# session_token is not used for an IAM user.
88+
self.session_token: typing.Optional[str] = None
89+
# The source IP address which initiates the connection to the Amazon Redshift server.
7390
self.source_address: typing.Optional[str] = None
74-
# The path to the UNIX socket to access the database through
75-
self.unix_sock: typing.Optional[str] = None
76-
# if use ssl authentication
91+
# if SSL authentication will be used
7792
self.ssl: bool = True
93+
# This property indicates whether the IDP hosts server certificate should be verified.
94+
self.ssl_insecure: bool = True
7895
# ssl mode: verify-ca or verify-full.
7996
self.sslmode: str = "verify-ca"
97+
# Use this property to enable or disable TCP keepalives.
98+
self.tcp_keepalive: bool = True
8099
# This is the time in seconds before the connection to the server will time out.
81100
self.timeout: typing.Optional[int] = None
82-
# max number of prepared statements
83-
self.max_prepared_statements: int = 1000
84-
# Use this property to enable or disable TCP keepalives. The following values are possible:
85-
self.tcp_keepalive: bool = True
86-
# client's requested transfer protocol version. See config.py for supported protocols
87-
self.client_protocol_version: int = DEFAULT_PROTOCOL_VERSION
88-
# Boolean indicating if application supports multidatabase datashare catalogs. Default value of True indicates the
89-
# application is does not support multidatabase datashare catalogs for backwards compatibility.
90-
self.database_metadata_current_db_only: bool = True
91-
# application name
92-
self.application_name: typing.Optional[str] = None
93-
# Used to run in streaming replication mode. If your server character encoding is not ascii or utf8,
94-
# then you need to provide values as bytes
95-
self.replication: typing.Optional[str] = None
96-
# parameter for PingIdentity
97-
self.partner_sp_id: typing.Optional[str] = None
98-
# parameters for BrowserIDP
99-
self.idp_response_timeout: int = 120
100-
self.listen_port: int = 7890
101-
self.login_url: typing.Optional[str] = None
101+
# The path to the UNIX socket to access the database through
102+
self.unix_sock: typing.Optional[str] = None
103+
# The user name.
104+
self.user_name: str = ""
102105
self.web_identity_token: typing.Optional[str] = None
103-
self.role_session_name: typing.Optional[str] = None
104-
self.role_arn: typing.Optional[str] = None
105-
self.iam_disable_cache: bool = False
106106

107107
else:
108108
for k, v in kwargs.items():

0 commit comments

Comments
 (0)