-
Notifications
You must be signed in to change notification settings - Fork 751
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
tests/suites/0_stateless/02_ddl/02_0000_create_drop_view.py
This file contains 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
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.