Database Class
Define a database class for a DataTransfer Component or Job.
- Inheritance
-
azure.ai.ml.entities._mixins.DictMixinDatabaseazure.ai.ml.entities._mixins.RestTranslatableMixinDatabase
Constructor
Database(*, query: str | None = None, table_name: str | None = None, stored_procedure: str | None = None, stored_procedure_params: List[Dict] | None = None, connection: str | None = None)
Keyword-Only Parameters
Name | Description |
---|---|
query
|
The SQL query to retrieve data from the database. |
table_name
|
The name of the database table. |
stored_procedure
|
The name of the stored procedure. |
stored_procedure_params
|
The parameters for the stored procedure. |
connection
|
The connection string for the database. The credential information should be stored in the connection. |
Examples
Create a database and querying a database table.
from azure.ai.ml.entities._inputs_outputs import Database
# For querying a database table
source_database = Database(query="SELECT * FROM my_table", connection="azureml:my_azuresql_connection")
# For invoking a stored procedure with parameters
stored_procedure_params = [
{"name": "job", "value": "Engineer", "type": "String"},
{"name": "department", "value": "Engineering", "type": "String"},
]
source_database = Database(
stored_procedure="SelectEmployeeByJobAndDepartment",
stored_procedure_params=stored_procedure_params,
connection="azureml:my_azuresql_connection",
)
Methods
get | |
has_key | |
items | |
keys | |
update | |
values |
get
get(key: Any, default: Any | None = None) -> Any
Parameters
Name | Description |
---|---|
key
Required
|
|
default
|
Default value: None
|
has_key
has_key(k: Any) -> bool
Parameters
Name | Description |
---|---|
k
Required
|
|
items
items() -> list
keys
keys() -> list
update
update(*args: Any, **kwargs: Any) -> None
values
values() -> list
Attributes
stored_procedure_params
Get or set the parameters for the stored procedure.
Returns
Type | Description |
---|---|
List[<xref:StoredProcedureParameter>]
|
The parameters for the stored procedure. |
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
Azure SDK for Python