Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
zhyass committed Sep 18, 2024
1 parent ce27d7d commit ddfa554
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/suites/0_stateless/02_ddl/02_0000_create_drop_view.py
Original file line number Diff line number Diff line change
@@ -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_issue_16188"))
with con.begin() as c:
c.execute(sqlalchemy.text("CREATE OR REPLACE VIEW v_issue_16188 as select a,b from t_issue_16188"))

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_issue_16188"))
c.execute(sqlalchemy.text("CREATE TABLE t_issue_16188 (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()
Empty file.

0 comments on commit ddfa554

Please sign in to comment.