SQL Plugin Model

Smarter API PluginData Sql Connection Manifest Constants

Smarter API Manifest - Plugin.spec

class smarter.apps.plugin.manifest.models.sql_plugin.spec.SAMSqlPluginSpec(*, selector: SAMPluginCommonSpecSelector, prompt: SAMPluginCommonSpecPrompt, connection: str, sqlData: SqlData)[source]

Bases: SAMPluginCommonSpec

Smarter API SqlData Connection Manifest SqlConnection.spec

class_identifier: ClassVar[str] = 'SqlPlugin.spec'
connection: str
model_config: ClassVar[ConfigDict] = {'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.

Return type:

None

Parameters:
  • self – The BaseModel instance.

  • context – The context.

sqlData: SqlData
validate_connection()[source]

Validate that the connection value is a valid cleanstring and that at least 1 record exists in the SqlConnection table with the given name.

If the model includes an authenticated user then also validate that at least 1 record exists in the SqlConnection table with the given name that is accessible by the authenticated user.

class smarter.apps.plugin.manifest.models.sql_plugin.spec.SqlData(*, sqlQuery: str, parameters: List[Parameter] | None = None, testValues: List[TestValue] | None = None, limit: Annotated[int | None, Gt(gt=0)] = 100)[source]

Bases: SmarterBasePydanticModel

Smarter API - generic API Connection class.

limit: int | None
model_config: ClassVar[ConfigDict] = {'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.

Return type:

None

Parameters:
  • self – The BaseModel instance.

  • context – The context.

parameters: List[Parameter] | None
sqlQuery: str
testValues: List[TestValue] | None

Smarter API Plugin Manifest

class smarter.apps.plugin.manifest.models.sql_plugin.model.SAMSqlPlugin(*, apiVersion: str, kind: str, metadata: SAMPluginCommonMetadata, spec: SAMSqlPluginSpec, status: SAMPluginCommonStatus | None = None)[source]

Bases: SAMPluginCommon

Smarter API Manifest - Sql Connection Model

class_identifier: ClassVar[str] = 'SqlPlugin'
model_config: ClassVar[ConfigDict] = {'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.

Return type:

None

Parameters:
  • self – The BaseModel instance.

  • context – The context.

spec: SAMSqlPluginSpec