Created
November 7, 2025 16:53
-
-
Save dveeden/75949e322ef63e4929ea738d70c4aba6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/python3 -tt | |
| import subprocess | |
| import mysql.connector | |
| tidb_config = { | |
| "host":'127.0.0.1', | |
| "port":4000, | |
| "user":'root', | |
| } | |
| mysql_config = { | |
| "host":'127.0.0.1', | |
| "port":3306, | |
| "user":'root', | |
| } | |
| tidb_con = mysql.connector.connect(**tidb_config) | |
| mysql_con = mysql.connector.connect(**mysql_config) | |
| tidb_cur = tidb_con.cursor() | |
| mysql_cur = mysql_con.cursor() | |
| queries = [ | |
| "SELECT VERSION()", | |
| "SELECT FORMAT(12345.67, 3, 'en_US')", | |
| ] | |
| locales = subprocess.Popen(["locale", "-a"], stdout=subprocess.PIPE).stdout.read() | |
| for l in locales.decode('utf-8').rstrip().split('\n'): | |
| queries.append(f"SELECT FORMAT(12345.67, 3, '{l}')") | |
| for q in queries: | |
| tidb_cur.execute(q) | |
| tidb_res = tidb_cur.fetchall() | |
| mysql_cur.execute(q) | |
| mysql_res = mysql_cur.fetchall() | |
| if tidb_res == mysql_res: | |
| # print(f"QUERY: {q}") | |
| # print(f" Equal:\n MySQL:\n {mysql_res}\n TiDB:\n {tidb_res}") | |
| pass | |
| else: | |
| print(f"QUERY: {q}") | |
| print(f" MySQL: {mysql_res[0][0]}\n TiDB : {tidb_res[0][0]}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment