diff --git a/tests/suites/0_stateless/02_ddl/02_0000_create_drop_view.py b/tests/suites/0_stateless/02_ddl/02_0000_create_drop_view.py new file mode 100755 index 0000000000000..dc5500bba440e --- /dev/null +++ b/tests/suites/0_stateless/02_ddl/02_0000_create_drop_view.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 + +import sqlalchemy +import os +from concurrent.futures import ThreadPoolExecutor, as_completed + +def recreate_view(con): + with con.begin() as c: + c.execute(sqlalchemy.text("DROP VIEW IF EXISTS v")) + with con.begin() as c: + c.execute(sqlalchemy.text("CREATE OR REPLACE VIEW v as select a,b from t")) + +def main(): + tcp_port = os.getenv("QUERY_MYSQL_HANDLER_PORT") + if tcp_port is None: + port = "3307" + else: + port = tcp_port + + uri = "mysql+pymysql://root:root@localhost:" + port + "/" + con = sqlalchemy.create_engine(uri, future=True) + with con.begin() as c: + c.execute(sqlalchemy.text("DROP TABLE IF EXISTS t")) + c.execute(sqlalchemy.text("CREATE TABLE t (a int not null, b int not null)")) + + with ThreadPoolExecutor(max_workers=64) as executor: + futures = [] + for _ in range(10): + futures.append(executor.submit(recreate_view, con)) + + for future in as_completed(futures): + future.result() + +if __name__ == '__main__': + main() diff --git a/tests/suites/0_stateless/02_ddl/02_0000_create_drop_view.result b/tests/suites/0_stateless/02_ddl/02_0000_create_drop_view.result new file mode 100644 index 0000000000000..e69de29bb2d1d