File: ml_samples_input_output_configurations.py

package info (click to toggle)
python-azure 20250603%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 851,724 kB
  • sloc: python: 7,362,925; ansic: 804; javascript: 287; makefile: 195; sh: 145; xml: 109
file content (43 lines) | stat: -rw-r--r-- 1,495 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# coding: utf-8

# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------

"""
FILE: ml_samples_input_output_configurations.py
DESCRIPTION:
    These samples configures for input and output of a component.
USAGE:
    python ml_samples_input_output_configurations.py

"""


class InputOutputConfigurationOptions(object):
    def ml_input_output_config(self):
        # [START configure_database]
        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",
        )

        # [END configure_database]


if __name__ == "__main__":
    sample = InputOutputConfigurationOptions()
    sample.ml_input_output_config()