sql_source
mlpype.sklearn.data.sql_source
Provides tools for using SQL as an input data source.
SqlSource
Bases: DataSource[DataFrame]
Reads data from a sql table using Pandas read_sql.
Source code in packages/mlpype-sklearn/src/mlpype/sklearn/data/sql_source.py
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 | |
__init__(sql, con, *args, **kwargs)
Reads data from a sql table using Pandas read_sql.
This class only works as a storage for the arguments to call Pandas read_sql. For proper documentation on the arguments, check Pandas read_sql.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sql
|
str
|
The sql and the |
required |
con
|
str
|
The con string and |
required |
*args
|
Any
|
Positional arguments to be passed to |
()
|
**kwargs
|
Any
|
Keyword arguments to be passed to |
{}
|
Source code in packages/mlpype-sklearn/src/mlpype/sklearn/data/sql_source.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
read()
Use the provided arguments to call read_sql.
Returns:
| Type | Description |
|---|---|
DataFrame
|
pd.DataFrame: The result of the provided query. |
Source code in packages/mlpype-sklearn/src/mlpype/sklearn/data/sql_source.py
37 38 39 40 41 42 43 | |