dolthub / dolt

Dolt – Git for Data
https://www.dolthub.com
Apache License 2.0
17.98k stars 516 forks source link

Tool dolphie needs `@@admin_version` system variable to return a numeric type. #8585

Open timsehn opened 2 days ago

timsehn commented 2 days ago

Repro:

  1. Start a Dolt sql-server on localhost.
  2. Install dolphie
    $ brew install dolphie
  3. Run:
    dolphie mysql://root@localhost:3306*

Error in dolphie:

image

Error in dolt sql-server:

 09:39:41.202391 -0800 PST m=+40.711971418" connectionDb= connectionID=1 error="Unknown system variable '@@admin'" query="SELECT @@admin-version"

I think we've also got a parsing problem with the - in system variables.

timsehn commented 2 days ago

Once this fix is in: https://github.com/dolthub/go-mysql-server/pull/2759

Dolt and MySQL fail in the exact same spot:

AttributeError: module 'os' has no attribute 'getloadavg'

Looks like a Python os package version issue.

jycor commented 2 days ago

The SELECT @@admin-version query is supposed fail. dolphie is using it to determine if this is a ProxySQL or MySQL connection.

           # If the query is successful, then the connection is to ProxySQL
            try:
                self.cursor.execute("SELECT @@admin-version")
                self.source = ConnectionSource.proxysql
            except Exception:
                self.source = ConnectionSource.mysql

Source: https://github.com/charles-001/dolphie/blob/9000c7167b97f192f53c1de22c954a7e7bde70a1/dolphie/Modules/MySQL.py#L72-L77

jycor commented 2 days ago

Update: It looks like one the system variables has a null value when it should be empty string

AttributeError: 'NoneType' object has no attribute 'isnumeric'
time="2024-11-22T12:31:51-08:00" level=debug msg="Query finished in 1 ms" connectTime="2024-11-22 12:31:46.1455538 -0800 PST m=+250.274868101" connectionDb=tmp2 connectionID=3 query="show global variables"