mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-29 11:02:08 +00:00
Add integration test for MySQL enums type
This commit is contained in:
parent
f609fd34f7
commit
a13d201991
@ -16,6 +16,7 @@ create_table_sql_template = """
|
|||||||
`name` varchar(50) NOT NULL,
|
`name` varchar(50) NOT NULL,
|
||||||
`age` int NOT NULL default 0,
|
`age` int NOT NULL default 0,
|
||||||
`money` int NOT NULL default 0,
|
`money` int NOT NULL default 0,
|
||||||
|
`source` enum('IP','URL') DEFAULT 'IP',
|
||||||
PRIMARY KEY (`id`)) ENGINE=InnoDB;
|
PRIMARY KEY (`id`)) ENGINE=InnoDB;
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -114,6 +115,19 @@ def test_table_function(started_cluster):
|
|||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
|
|
||||||
|
def test_enum_type(started_cluster):
|
||||||
|
table_name = 'test_enum_type'
|
||||||
|
conn = get_mysql_conn()
|
||||||
|
create_mysql_table(conn, table_name)
|
||||||
|
node1.query('''
|
||||||
|
CREATE TABLE {}(id UInt32, name String, age UInt32, money UInt32, source Enum8('IP' = 1, 'URL' = 2)) ENGINE = MySQL('mysql1:3306', 'clickhouse', '{}', 'root', 'clickhouse', 1);
|
||||||
|
'''.format(table_name, table_name))
|
||||||
|
node1.query("INSERT INTO {}(id, name, age, money) VALUES (1,'name',0, 0)".format(table_name))
|
||||||
|
assert node1.query("SELECT source FROM {} LIMIT 1".format(table_name)).rstrip() == 'IP'
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_mysql_conn():
|
def get_mysql_conn():
|
||||||
conn = pymysql.connect(user='root', password='clickhouse', host='127.0.0.1', port=3308)
|
conn = pymysql.connect(user='root', password='clickhouse', host='127.0.0.1', port=3308)
|
||||||
return conn
|
return conn
|
||||||
|
Loading…
Reference in New Issue
Block a user