Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transformation tool does not use correct connection string for SQL Server #150

Open
carlfischerjba opened this issue Oct 28, 2024 · 0 comments
Assignees

Comments

@carlfischerjba
Copy link

Issue Description

When reading exposure data from a SQL Server database using a custom port, the connection fails.

Steps to Reproduce (Bugs only)

Here's the config file.

transformations:
  loc: # Transformation name
    input_format:
      name: Cede_Location
      version: 10.0.0
    output_format:
      name: OED_Location
      version: 3.0.2
    runner:
      batch_size: 750000 # Number of rows to process in a single batch
    extractor:
      type: mssql # Path to the DB connection file. Other options are 'postgres' and 'sqlite'. Defaults to 'csv', when not present.
      options:
        host: myserver
        port: 1450
        database: MY_DB
        user: foo
        password: bar
        sql_statement: ./cede_location.sql # SQL statement to extract data
    loader:
      options:
        path: ./CF_oed_location.csv # Path to the output file
        quoting: minimal

And the command used:

ods_tools transform --config-file /path/to/CF_config.yaml

The output is:

2024-10-28 16:18:13,612 - ERROR - DBConnectionError(), line 160 in /home/carl/venvs/myvenv/lib/python3.10/site-packages/ods_tools/odtf/controller.py

Version / Environment information

  • ods-tools 3.2.5

Example data / logs

This can be fixed by setting the port as part of the server string:

        host: myserver,1450
        port:

But would perhaps be better done in code at

"DRIVER={};SERVER={};PORT={};DATABASE={};UID={};PWD={}".format(
.

            conn = pyodbc.connect(
                "DRIVER={};SERVER={},{};DATABASE={};UID={};PWD={}".format(
                    self.driver,
                    database["host"],
                    database["port"],
                    database["database"],
                    database["user"],
                    database["password"],
                )
            )
@benhayes21 benhayes21 self-assigned this Nov 20, 2024
@benhayes21 benhayes21 moved this to In Progress in Oasis Dev Team Tasks Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

No branches or pull requests

2 participants