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
Source plugin for Microsoft SQL Server.
Initialize the MSSQLSource with a connection string and a query.
Parameters
connection_stringstrThe connection string to connect to the database.
querystr | list[str]The SQL query or queries to execute.
chunk_sizeintThe number of rows to fetch in each chunk. Defaults to 50000.
Properties
connection_stringstrGet the connection string for the database.
Returns: str: The connection string.
credentialsUserPasswordCredentials | NoneThe credentials required to access Microsoft SQL Server. If no credentials were provided, it will return None.
initial_valuesdictThe initial values for the parameters in the SQL queries.
querylist[str]Get the SQL query or queries to execute.
Returns: str | list[str]: The SQL query or queries.
Methods
chunkdef chunk(working_dir: str)
Execute the query and yield chunks of data.
pd.DataFrame: A chunk of data from the query result.
Parameters:
working_dirstrThe working directory for temporary files.