SQL Connection Model
Smarter API SQL Connection Manifest Constants.
Smarter API Manifest - SqlConnection.spec.
- class smarter.apps.connection.manifest.models.sql_connection.spec.Connection(*, dbEngine, hostname, port=None, database, username=None, password=None, timeout=30, useSsl=False, sslCert=None, sslKey=None, sslCa=None, proxyHost=None, proxyPort=None, proxyUsername=None, proxyPassword=None, sshKnownHosts=None, poolSize=5, maxOverflow=10, authenticationMethod='none')[source]
Bases:
SmarterBasePydanticModelSmarter API - generic SQL Connection class.
- model_config = {'arbitrary_types_allowed': True, 'from_attributes': True, 'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context, /)
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- classmethod validate_authentication_method(v)[source]
Validate that
authenticationMethodis one of the supported authentication methods.- Parameters:
v – The authentication method.
- Return type:
- Returns:
The authentication method, unchanged.
- Raises:
SAMValidationError – if it is not in
DBMSAuthenticationMethods.all().
- classmethod validate_database(v)[source]
Validate that
databaseis a clean string.- Parameters:
v – The database name.
- Return type:
- Returns:
The database name, unchanged.
- Raises:
SAMValidationError – if it is not a clean string.
- classmethod validate_db_engine(v)[source]
Validate that
dbEngineis one of the supported Django database backends.- Parameters:
v – The database engine.
- Return type:
- Returns:
The database engine, unchanged.
- Raises:
SAMValidationError – if it is not in
DbEngines.all().
- classmethod validate_host(v)[source]
Validate that
hostnameis a clean string.- Parameters:
v – The database host.
- Return type:
- Returns:
The host, unchanged.
- Raises:
SAMValidationError – if it is not a clean string.
- classmethod validate_max_overflow(v)[source]
Validate that
maxOverflow, when set, is 0 or greater.- Parameters:
v – The maximum pool overflow, or None.
- Return type:
- Returns:
The maximum overflow, unchanged.
- Raises:
SAMValidationError – if it is negative.
- classmethod validate_password(v)[source]
Accept
passwordas is: it is the name of a Secret, not the password itself.- Parameters:
v – The name of the Secret that holds the password.
- Return type:
- Returns:
The value, unchanged.
- classmethod validate_pool_size(v)[source]
Validate that
poolSize, when set, is greater than 0.- Parameters:
v – The connection pool size, or None.
- Return type:
- Returns:
The pool size, unchanged.
- Raises:
SAMValidationError – if it is not greater than 0.
- classmethod validate_port(v, values)[source]
Default
portfrom the database engine when it is missing, and validate its range.- Parameters:
v – The port, or None.
values – The values of the model’s other fields, used to look up
dbEngine.
- Return type:
- Returns:
The port, or the default port of the database engine when the port is None and the engine has one.
- Raises:
SAMValidationError – if the port is not between 1 and 65535.
- classmethod validate_proxy_host(v)[source]
Validate that
proxyHost, when set, is a valid domain.- Parameters:
v – The proxy host, or None.
- Return type:
- Returns:
The proxy host, unchanged.
- Raises:
SAMValidationError – if it is not a valid domain.
- classmethod validate_proxy_port(v)[source]
Validate that
proxyPort, when set, is between 1 and 65535.- Parameters:
v – The proxy port, or None.
- Return type:
- Returns:
The proxy port, unchanged.
- Raises:
SAMValidationError – if it is out of range.
- classmethod validate_timeout(v)[source]
Default
timeoutwhen it is missing or 0, and validate that it is positive.- Parameters:
v – The timeout in seconds, or None.
- Return type:
- Returns:
The timeout, or
SqlConnection.DBMS_DEFAULT_TIMEOUTwhen it is falsy.- Raises:
SAMValidationError – if the timeout is not greater than 0.
- classmethod validate_use_ssl(v)[source]
Validate that
useSslis a boolean.- Parameters:
v – Whether to use SSL.
- Return type:
- Returns:
The value, unchanged.
- Raises:
SAMValidationError – if it is not a boolean.
- classmethod validate_username(v)[source]
Validate that
username, when set, is a clean string.- Parameters:
v – The username, or None.
- Return type:
- Returns:
The username, unchanged.
- Raises:
SAMValidationError – if it is not a clean string.
- class smarter.apps.connection.manifest.models.sql_connection.spec.SAMSqlConnectionSpec(*, connection)[source]
Bases:
AbstractSAMSpecBaseSmarter API Sql Connection Manifest Connection.spec.
- connection: Connection
- model_config = {'arbitrary_types_allowed': True, 'from_attributes': True, 'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context, /)
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
Smarter API SqlConnection Manifest.
- class smarter.apps.connection.manifest.models.sql_connection.model.SAMSqlConnection(*, apiVersion, kind, metadata, spec, status=None)[source]
Bases:
SAMConnectionCommonSmarter API Manifest - SqlConnection Model.
- metadata: SAMConnectionCommonMetadata
- model_config = {'arbitrary_types_allowed': True, 'from_attributes': True, 'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context, /)
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- spec: SAMSqlConnectionSpec
- status: SAMConnectionCommonStatus | None