Skip to content

Using manage.py dbshell with ODBC 17 results in a error by runshell #100

Open
@braiam

Description

@braiam

For the following database configuration

DATABASES = {
    'default': {
        'ENGINE': 'sql_server.pyodbc',
        'NAME': 'actual_name',
        'HOST': 'actual_ip',
        'USER': 'user',
        'PASSWORD': 'secret',
        'OPTIONS': {
            'driver': 'ODBC Driver 17 for SQL Server',
            'connection_timeout': 15
        },
    },
}

Calling dbshell results on the following error:

Traceback (most recent call last):
  File "/home/braiam/Documents/incart/src/incart/./manage.py", line 22, in <module>
    main()
  File "/home/braiam/Documents/incart/src/incart/./manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python3/dist-packages/django/core/management/base.py", line 330, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/lib/python3/dist-packages/django/core/management/base.py", line 371, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/python3/dist-packages/django/core/management/commands/dbshell.py", line 26, in handle
    connection.client.runshell(options['parameters'])
TypeError: runshell() takes 1 positional argument but 2 were given

According to 3.1 release notes there's a backwards incompatible change for the runshell function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions