[Python] Can't connect to SQL server using gcloud

Discussão em 'Python' iniciado por Stack, Julho 3, 2025.

  1. Stack

    Stack Membro Participativo

    I have an MSSQL server setup in GCP. It has a private IP.

    I have gcloud installed on ubuntu 20 (WSL2).

    When I run this command I get an error:

    > gcloud beta sql connect <instance name> --user=<user name>
    ...
    ImportError: cannot import name 'Iterable' from 'collections' (/usr/lib/python3.11/collections/__init__.py)


    I had a lot of difficulty installing the mssql-cli module.

    I guess there's some version mismatch here.


    > which python
    /usr/bin/python

    > python --version
    Python 3.11.4


    I have both of these installed, which doesn't seem right.

    > pip freeze
    ...
    mssql-cli==1.0.0
    mssqlcli==1.0.4
    ...


    I get a similar error when using gcloud without the "beta".

    Any suggestions as to what the mismatch might be?

    I've been fairly unimpressed with gcloud so far.

    Continue reading...

Compartilhe esta Página