pingcap / pingcap/tiup

Create easy to import config for popular DB Tools

Open
#2,252 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type/feature-request
Dominant language
Go
Stars
466
Forks
338
Avg merge
3d 7h
Merged PRs (30d)
8

Description

Feature Request

Describe the feature you'd like:

It would be nice if we could make it easier to use various DB tools by creating the right config files etc.

This could maybe replace tiup client and also be usable as client for tiup cluster / tiup cloud managed clusters.

DBeaver
$ jq .connections .local/share/DBeaverData/workspace6/General/.dbeaver/data-sources.json
{
  "tidb-187b9278891-574aba6a9053e313": {
    "provider": "tidb",
    "driver": "tidb",
    "name": "test",
    "save-password": true,
    "configuration": {
      "host": "127.0.0.1",
      "port": "4000",
      "database": "test",
      "url": "jdbc:mysql://127.0.0.1:4000/test",
      "configurationType": "MANUAL",
      "type": "dev",
      "properties": {
        "connectTimeout": "20000",
        "loginTimeout": "20000",
        "rewriteBatchedStatements": "true",
        "useCompression": "true",
        "enabledTLSProtocols": "TLSv1.2,TLSv1.3"
      },
      "auth-model": "native"
    }
  }
}

DBeaver can also import connections from a CSV file.
See also: https://dbeaver.com/docs/wiki/Admin-Manage-Connections/

MySQL Workbench

Copying something like mysql://root@127.0.0.1:4001/test to the clipboard and using the "Add Connection(s) from Clipboard" option seems to work fine if we create the right clipboard content.

Connections are stored in ~/.mysql/workbench/connections.xml

<?xml version="1.0"?>
<data grt_format="2.0">
  <value _ptr_="0xf28040" type="list" content-type="object" content-struct-name="db.mgmt.Connection">
    <value type="object" struct-name="db.mgmt.Connection" id="e9573666-93ba-11eb-b54a-5405db7aad56" struct-checksum="0x96ba47d8">
      <link type="object" struct-name="db.mgmt.Driver" key="driver">com.mysql.rdbms.mysql.driver.native</link>
      <value type="string" key="hostIdentifier">Mysql@127.0.0.1:4000</value>
      <value type="int" key="isDefault">1</value>
      <value _ptr_="0x18b7150" type="dict" key="modules"/>
      <value _ptr_="0x18b71d0" type="dict" key="parameterValues">
        <value type="int" key="CLIENT_COMPRESS">1</value>
        <value type="string" key="SQL_MODE"></value>
        <value type="string" key="hostName">127.0.0.1</value>
        <value type="int" key="lastConnected">1692015085</value>
        <value type="string" key="password"></value>
        <value type="int" key="port">4000</value>
        <value type="string" key="serverVersion">5.7.25-TiDB-v7.4.0-alpha-79-g92b5a67606-dirty</value>
        <value type="string" key="sslCA"></value>
        <value type="string" key="sslCert"></value>
        <value type="string" key="sslCipher"></value>
        <value type="string" key="sslKey"></value>
        <value type="int" key="useSSL">0</value>
        <value type="string" key="userName">root</value>
      </value>
      <value type="string" key="name">TiDB playground</value>
      <link type="object" struct-name="GrtObject" key="owner">af131882-3a9b-11ee-bc86-5405db7aad56</link>
    </value>
  </value>
</data>
MySQL Client

Instead of arguments like this:

mysql --comments --host 127.0.0.1 --port 4000 -u root

It is possible to use something like this:

mysql --defaults-file=tidb-playground.ini

With a tidb-playground.ini file like this:

[client]
host = 127.0.0.1
port = 4000
user = root

[mysql]
comments
prompt = "TiDB \u [\d] > "

This also sets the prompt, which the other command doesn't do.

Why the featue is needed:
Improved usability

Describe alternatives you've considered:

Teachability, Documentation, Adoption, Migration Strategy:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing tiup client behavior and the configuration formats shown for DBeaver, MySQL Workbench, and the MySQL client. The work is done when TiUP can create or provide importable connection configuration for the listed DB tools and managed clusters, with the supported scope defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, mysql
Domain
cli, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.