Skip to content

SQLServer

Bases: Spout

__init__(output, state, **kwargs)

Initialize the SQLServer class.

Parameters:

Name Type Description Default
output BatchOutput

An instance of the BatchOutput class for saving the data.

required
state State

An instance of the State class for maintaining the state.

required
**kwargs

Additional keyword arguments.

{}

Using geniusrise to invoke via command line

genius SQLServer rise \
    batch \
        --output_s3_bucket my_bucket \
        --output_s3_folder s3/folder \
    none \
    fetch \
        --args server=localhost port=1433 user=myuser password=mypassword database=mydatabase query="SELECT * FROM mytable"

Using geniusrise to invoke via YAML file

version: "1"
spouts:
    my_sqlserver_spout:
        name: "SQLServer"
        method: "fetch"
        args:
            server: "localhost"
            port: 1433
            user: "myuser"
            password: "mypassword"
            database: "mydatabase"
            query: "SELECT * FROM mytable"
        output:
            type: "batch"
            args:
                bucket: "my_bucket"
                s3_folder: "s3/folder"

fetch(server, port, user, password, database, query)

📖 Fetch data from a SQL Server database and save it in batch.

Parameters:

Name Type Description Default
server str

The SQL Server host.

required
port int

The SQL Server port.

required
user str

The SQL Server user.

required
password str

The SQL Server password.

required
database str

The SQL Server database name.

required
query str

The SQL query to execute.

required

Raises:

Type Description
Exception

If unable to connect to the SQL Server server or execute the query.