mirror of
https://github.com/dolthub/dolt.git
synced 2026-04-24 03:16:12 -05:00
add hash column to result set for dolt_merge(..., '--no-ff') (#6163)
This commit is contained in:
@@ -1,70 +1,70 @@
|
||||
import mysql.connector
|
||||
import sys
|
||||
|
||||
QUERY_RESPONSE = [
|
||||
{"create table test (pk int, `value` int, primary key(pk))": []},
|
||||
{"describe test": [
|
||||
('pk', 'int', 'NO', 'PRI', 'NULL', ''),
|
||||
('value', 'int', 'YES', '', 'NULL', '')
|
||||
]},
|
||||
{"insert into test (pk, `value`) values (0,0)": []},
|
||||
{"select * from test": [(0, 0)]},
|
||||
# We used to have a bug where spaces after a semicolon in a query
|
||||
# would cause a client/server disconnect.
|
||||
# https://github.com/dolthub/vitess/pull/65
|
||||
# The following regression tests it.
|
||||
{"select * from test; ": [(0, 0)]},
|
||||
{"select * from test; ": [(0, 0)]},
|
||||
# Test the Dolt SQL functions
|
||||
{"call dolt_add('-A');": [(0,)]},
|
||||
{"call dolt_commit('-m', 'my commit')": [('',)]},
|
||||
{"select COUNT(*) FROM dolt_log": [(2,)]},
|
||||
{"call dolt_checkout('-b', 'mybranch')": [(0,)]},
|
||||
{"insert into test (pk, `value`) values (1,1)": []},
|
||||
{"call dolt_commit('-a', '-m', 'my commit2')": [('',)]},
|
||||
{"call dolt_checkout('main')": [(0,)]},
|
||||
{"call dolt_merge('mybranch')": [(1,0,)]},
|
||||
{"select COUNT(*) FROM dolt_log": [(3,)]},
|
||||
]
|
||||
|
||||
|
||||
def main():
|
||||
user = sys.argv[1]
|
||||
port = sys.argv[2]
|
||||
db = sys.argv[3]
|
||||
|
||||
connection = mysql.connector.connect(user=user,
|
||||
host="127.0.0.1",
|
||||
port=port,
|
||||
database=db)
|
||||
|
||||
for query_response in QUERY_RESPONSE:
|
||||
query = list(query_response.keys())[0]
|
||||
exp_results = query_response[query]
|
||||
cursor = connection.cursor()
|
||||
cursor.execute(query)
|
||||
try:
|
||||
results = cursor.fetchall()
|
||||
print(exp_results)
|
||||
print(results)
|
||||
if (results != exp_results) and ("dolt_commit" not in query):
|
||||
print("Query:")
|
||||
print(query)
|
||||
print("Expected:")
|
||||
print(exp_results)
|
||||
print("Received:")
|
||||
print(results)
|
||||
exit(1)
|
||||
except mysql.connector.errors.InterfaceError:
|
||||
|
||||
# This is a write query
|
||||
pass
|
||||
|
||||
cursor.close()
|
||||
|
||||
connection.close()
|
||||
|
||||
exit(0)
|
||||
|
||||
|
||||
main()
|
||||
import mysql.connector
|
||||
import sys
|
||||
|
||||
QUERY_RESPONSE = [
|
||||
{"create table test (pk int, `value` int, primary key(pk))": []},
|
||||
{"describe test": [
|
||||
('pk', 'int', 'NO', 'PRI', 'NULL', ''),
|
||||
('value', 'int', 'YES', '', 'NULL', '')
|
||||
]},
|
||||
{"insert into test (pk, `value`) values (0,0)": []},
|
||||
{"select * from test": [(0, 0)]},
|
||||
# We used to have a bug where spaces after a semicolon in a query
|
||||
# would cause a client/server disconnect.
|
||||
# https://github.com/dolthub/vitess/pull/65
|
||||
# The following regression tests it.
|
||||
{"select * from test; ": [(0, 0)]},
|
||||
{"select * from test; ": [(0, 0)]},
|
||||
# Test the Dolt SQL functions
|
||||
{"call dolt_add('-A');": [(0,)]},
|
||||
{"call dolt_commit('-m', 'my commit')": [('',)]},
|
||||
{"select COUNT(*) FROM dolt_log": [(2,)]},
|
||||
{"call dolt_checkout('-b', 'mybranch')": [(0,)]},
|
||||
{"insert into test (pk, `value`) values (1,1)": []},
|
||||
{"call dolt_commit('-a', '-m', 'my commit2')": [('',)]},
|
||||
{"call dolt_checkout('main')": [(0,)]},
|
||||
{"call dolt_merge('mybranch')": [('',1,0,)]},
|
||||
{"select COUNT(*) FROM dolt_log": [(3,)]},
|
||||
]
|
||||
|
||||
|
||||
def main():
|
||||
user = sys.argv[1]
|
||||
port = sys.argv[2]
|
||||
db = sys.argv[3]
|
||||
|
||||
connection = mysql.connector.connect(user=user,
|
||||
host="127.0.0.1",
|
||||
port=port,
|
||||
database=db)
|
||||
|
||||
for query_response in QUERY_RESPONSE:
|
||||
query = list(query_response.keys())[0]
|
||||
exp_results = query_response[query]
|
||||
cursor = connection.cursor()
|
||||
cursor.execute(query)
|
||||
try:
|
||||
results = cursor.fetchall()
|
||||
print(exp_results)
|
||||
print(results)
|
||||
if (results != exp_results) and ("dolt_commit" not in query):
|
||||
print("Query:")
|
||||
print(query)
|
||||
print("Expected:")
|
||||
print(exp_results)
|
||||
print("Received:")
|
||||
print(results)
|
||||
exit(1)
|
||||
except mysql.connector.errors.InterfaceError:
|
||||
|
||||
# This is a write query
|
||||
pass
|
||||
|
||||
cursor.close()
|
||||
|
||||
connection.close()
|
||||
|
||||
exit(0)
|
||||
|
||||
|
||||
main()
|
||||
|
||||
@@ -1,54 +1,54 @@
|
||||
import pymysql
|
||||
import sys
|
||||
|
||||
QUERY_RESPONSE = [
|
||||
{"create table test (pk int, `value` int, primary key(pk))": ()},
|
||||
{"describe test": (
|
||||
('pk', 'int', 'NO', 'PRI', 'NULL', ''),
|
||||
('value', 'int', 'YES', '', 'NULL', '')
|
||||
)},
|
||||
{"insert into test (pk, `value`) values (0,0)": ()},
|
||||
{"select * from test": ((0, 0),)},
|
||||
{"call dolt_add('-A');": ((0,),)},
|
||||
{"call dolt_commit('-m', 'my commit')": (('',),)},
|
||||
{"select COUNT(*) FROM dolt_log": ((2,),)},
|
||||
{"call dolt_checkout('-b', 'mybranch')": ((0,),)},
|
||||
{"insert into test (pk, `value`) values (1,1)": ()},
|
||||
{"call dolt_commit('-a', '-m', 'my commit2')": (('',),)},
|
||||
{"call dolt_checkout('main')": ((0,),)},
|
||||
{"call dolt_merge('mybranch')": ((1,0,),)},
|
||||
{"select COUNT(*) FROM dolt_log": ((3,),)},
|
||||
]
|
||||
|
||||
|
||||
def main():
|
||||
user = sys.argv[1]
|
||||
port = int(sys.argv[2])
|
||||
db = sys.argv[3]
|
||||
|
||||
connection = pymysql.connect(host="127.0.0.1",
|
||||
port=port,
|
||||
user=user,
|
||||
db=db)
|
||||
|
||||
for query_response in QUERY_RESPONSE:
|
||||
query = list(query_response.keys())[0]
|
||||
exp_results = query_response[query]
|
||||
with connection.cursor() as cursor:
|
||||
cursor.execute(query)
|
||||
results = cursor.fetchall()
|
||||
if (results != exp_results) and ("dolt_commit" not in query):
|
||||
print("Query:")
|
||||
print(query)
|
||||
print("Expected:")
|
||||
print(exp_results)
|
||||
print("Received:")
|
||||
print(results)
|
||||
exit(1)
|
||||
|
||||
connection.close()
|
||||
|
||||
exit(0)
|
||||
|
||||
|
||||
main()
|
||||
import pymysql
|
||||
import sys
|
||||
|
||||
QUERY_RESPONSE = [
|
||||
{"create table test (pk int, `value` int, primary key(pk))": ()},
|
||||
{"describe test": (
|
||||
('pk', 'int', 'NO', 'PRI', 'NULL', ''),
|
||||
('value', 'int', 'YES', '', 'NULL', '')
|
||||
)},
|
||||
{"insert into test (pk, `value`) values (0,0)": ()},
|
||||
{"select * from test": ((0, 0),)},
|
||||
{"call dolt_add('-A');": ((0,),)},
|
||||
{"call dolt_commit('-m', 'my commit')": (('',),)},
|
||||
{"select COUNT(*) FROM dolt_log": ((2,),)},
|
||||
{"call dolt_checkout('-b', 'mybranch')": ((0,),)},
|
||||
{"insert into test (pk, `value`) values (1,1)": ()},
|
||||
{"call dolt_commit('-a', '-m', 'my commit2')": (('',),)},
|
||||
{"call dolt_checkout('main')": ((0,),)},
|
||||
{"call dolt_merge('mybranch')": (('',1,0,),)},
|
||||
{"select COUNT(*) FROM dolt_log": ((3,),)},
|
||||
]
|
||||
|
||||
|
||||
def main():
|
||||
user = sys.argv[1]
|
||||
port = int(sys.argv[2])
|
||||
db = sys.argv[3]
|
||||
|
||||
connection = pymysql.connect(host="127.0.0.1",
|
||||
port=port,
|
||||
user=user,
|
||||
db=db)
|
||||
|
||||
for query_response in QUERY_RESPONSE:
|
||||
query = list(query_response.keys())[0]
|
||||
exp_results = query_response[query]
|
||||
with connection.cursor() as cursor:
|
||||
cursor.execute(query)
|
||||
results = cursor.fetchall()
|
||||
if (results != exp_results) and ("dolt_commit" not in query):
|
||||
print("Query:")
|
||||
print(query)
|
||||
print("Expected:")
|
||||
print(exp_results)
|
||||
print("Received:")
|
||||
print(results)
|
||||
exit(1)
|
||||
|
||||
connection.close()
|
||||
|
||||
exit(0)
|
||||
|
||||
|
||||
main()
|
||||
|
||||
@@ -1,67 +1,67 @@
|
||||
import sqlalchemy
|
||||
|
||||
from sqlalchemy.engine import Engine
|
||||
from sqlalchemy import create_engine
|
||||
|
||||
import sys
|
||||
|
||||
QUERY_RESPONSE = [
|
||||
{"create table test (pk int, `value` int, primary key(pk))": []},
|
||||
{"describe test": [
|
||||
('pk', 'int', 'NO', 'PRI', 'NULL', ''),
|
||||
('value', 'int', 'YES', '', 'NULL', '')
|
||||
]},
|
||||
{"insert into test (pk, `value`) values (0,0)": ()},
|
||||
{"select * from test": [(0, 0)]},
|
||||
{"call dolt_add('-A');": [(0,)]},
|
||||
{"call dolt_commit('-m', 'my commit')": [('',)]},
|
||||
{"select COUNT(*) FROM dolt_log": [(2,)]},
|
||||
{"call dolt_checkout('-b', 'mybranch')": [(0,)]},
|
||||
{"insert into test (pk, `value`) values (1,1)": []},
|
||||
{"call dolt_commit('-a', '-m', 'my commit2')": [('',)]},
|
||||
{"call dolt_checkout('main')": [(0,)]},
|
||||
{"call dolt_merge('mybranch')": [(1,0,)]},
|
||||
{"select COUNT(*) FROM dolt_log": [(3,)]},
|
||||
]
|
||||
|
||||
|
||||
def main():
|
||||
user = sys.argv[1]
|
||||
port = int(sys.argv[2])
|
||||
db = sys.argv[3]
|
||||
|
||||
conn_string_base = "mysql+mysqlconnector://"
|
||||
|
||||
engine = create_engine(conn_string_base +
|
||||
"{user}@127.0.0.1:{port}/{db}".format(user=user,
|
||||
port=port,
|
||||
db=db)
|
||||
)
|
||||
|
||||
with engine.connect() as con:
|
||||
for query_response in QUERY_RESPONSE:
|
||||
query = list(query_response.keys())[0]
|
||||
exp_results = query_response[query]
|
||||
|
||||
result_proxy = con.execute(query)
|
||||
|
||||
try:
|
||||
results = result_proxy.fetchall()
|
||||
if (results != exp_results) and ("dolt_commit" not in query):
|
||||
print("Query:")
|
||||
print(query)
|
||||
print("Expected:")
|
||||
print(exp_results)
|
||||
print("Received:")
|
||||
print(results)
|
||||
exit(1)
|
||||
# You can't call fetchall on an insert
|
||||
# so we'll just ignore the exception
|
||||
except sqlalchemy.exc.ResourceClosedError:
|
||||
pass
|
||||
|
||||
con.close()
|
||||
exit(0)
|
||||
|
||||
|
||||
main()
|
||||
import sqlalchemy
|
||||
|
||||
from sqlalchemy.engine import Engine
|
||||
from sqlalchemy import create_engine
|
||||
|
||||
import sys
|
||||
|
||||
QUERY_RESPONSE = [
|
||||
{"create table test (pk int, `value` int, primary key(pk))": []},
|
||||
{"describe test": [
|
||||
('pk', 'int', 'NO', 'PRI', 'NULL', ''),
|
||||
('value', 'int', 'YES', '', 'NULL', '')
|
||||
]},
|
||||
{"insert into test (pk, `value`) values (0,0)": ()},
|
||||
{"select * from test": [(0, 0)]},
|
||||
{"call dolt_add('-A');": [(0,)]},
|
||||
{"call dolt_commit('-m', 'my commit')": [('',)]},
|
||||
{"select COUNT(*) FROM dolt_log": [(2,)]},
|
||||
{"call dolt_checkout('-b', 'mybranch')": [(0,)]},
|
||||
{"insert into test (pk, `value`) values (1,1)": []},
|
||||
{"call dolt_commit('-a', '-m', 'my commit2')": [('',)]},
|
||||
{"call dolt_checkout('main')": [(0,)]},
|
||||
{"call dolt_merge('mybranch')": [('',1,0,)]},
|
||||
{"select COUNT(*) FROM dolt_log": [(3,)]},
|
||||
]
|
||||
|
||||
|
||||
def main():
|
||||
user = sys.argv[1]
|
||||
port = int(sys.argv[2])
|
||||
db = sys.argv[3]
|
||||
|
||||
conn_string_base = "mysql+mysqlconnector://"
|
||||
|
||||
engine = create_engine(conn_string_base +
|
||||
"{user}@127.0.0.1:{port}/{db}".format(user=user,
|
||||
port=port,
|
||||
db=db)
|
||||
)
|
||||
|
||||
with engine.connect() as con:
|
||||
for query_response in QUERY_RESPONSE:
|
||||
query = list(query_response.keys())[0]
|
||||
exp_results = query_response[query]
|
||||
|
||||
result_proxy = con.execute(query)
|
||||
|
||||
try:
|
||||
results = result_proxy.fetchall()
|
||||
if (results != exp_results) and ("dolt_commit" not in query):
|
||||
print("Query:")
|
||||
print(query)
|
||||
print("Expected:")
|
||||
print(exp_results)
|
||||
print("Received:")
|
||||
print(results)
|
||||
exit(1)
|
||||
# You can't call fetchall on an insert
|
||||
# so we'll just ignore the exception
|
||||
except sqlalchemy.exc.ResourceClosedError:
|
||||
pass
|
||||
|
||||
con.close()
|
||||
exit(0)
|
||||
|
||||
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user