Skip to main content
Version: 1.8.0

MSSQLSource

class MSSQLSource(
connection_string: str,
query: str | list[str],
chunk_size: int = 50000,
credentials: dict | UserPasswordCredentials | None = None,
server: str | Secret = None,
database: str | Secret = None,
driver: str | Secret = None,
initial_values: dict | None = None,
**kwargs,
)

Bases: SourcePlugin

Categories: source

Microsoft SQL Server based data inputs.

Initialize the MSSQLSource with a connection string and a query.

Parameters

parameter
connection_string

The connection string to connect to the database.

parameter
query

The SQL query or queries to execute.

parameter
chunk_size

The number of rows to fetch in each chunk. Defaults to 50000.

Properties

property
connection_stringstr

Get the connection string for the database.

Returns: str: The connection string.

property
credentialsUserPasswordCredentials | None

The credentials required to access Microsoft SQL Server. If no credentials were provided, it will return None.

property
initial_valuesdict

The initial values for the parameters in the SQL queries.

property
querylist[str]

Get the SQL query or queries to execute.

Returns: str | list[str]: The SQL query or queries.

Methods

chunk
def chunk(working_dir: str)

Execute the query and yield chunks of data.

warning

pd.DataFrame: A chunk of data from the query result.

Parameters:

parameter
working_dirstr

The working directory for temporary files.