userver: en/testsuite/databases/mysql/utils.py Source File
Loading...
Searching...
No Matches
utils.py
1import pathlib
2import typing
3
4
5def load_queries_directory(root: pathlib.Path) -> typing.Iterable[str]:
6 for path in scan_sql_directory(root):
7 yield path.read_text()
8
9
10def scan_sql_directory(root: pathlib.Path) -> list[pathlib.Path]:
11 return [
12 path
13 for path in sorted(root.iterdir())
14 if path.is_file() and path.suffix == '.sql'
15 ]