userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
discover.py
1
import
collections
2
import
pathlib
3
import
typing
4
5
from
.
import
classes, utils
6
7
8
def
find_schemas(
9
schema_dirs: list[pathlib.Path],
10
dbprefix: str =
'testsuite-'
,
11
) -> dict[str, classes.DatabaseConfig]:
12
result = {}
13
for
path
in
schema_dirs:
14
if
not
path.is_dir():
15
continue
16
for
dbname, migrations
in
_scan_path(path).items():
17
full_db_name: str = dbprefix + dbname
18
result[dbname] = classes.DatabaseConfig(
19
dbname=full_db_name,
20
migrations=migrations,
21
)
22
23
return
result
24
25
26
def
_scan_path(
27
schema_path: pathlib.Path,
28
) -> typing.DefaultDict[str, list[pathlib.Path]]:
29
result = collections.defaultdict(list)
30
for
entry
in
schema_path.iterdir():
31
if
entry.suffix ==
'.sql'
and
entry.is_file():
32
result[entry.stem].append(entry)
33
elif
entry.is_dir():
34
result[entry.stem].extend(utils.scan_sql_directory(entry))
35
36
return
result
en
testsuite
databases
clickhouse
discover.py
Generated on
for userver by
Doxygen
1.17.0