• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

georgia-tech-db / eva / ba2a2525-3c3b-401d-94ef-945fffb0ca3d

pending completion
ba2a2525-3c3b-401d-94ef-945fffb0ca3d

Pull #924

circle-ci

xzdandy
include notebook 11 in the circle ci test
Pull Request #924: fix tutorials 11-similarity-search-for-motif-mining.ipynb

42 of 42 new or added lines in 8 files covered. (100.0%)

10144 of 10654 relevant lines covered (95.21%)

1.9 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.15
/evadb/database.py
1
# coding=utf-8
2
# Copyright 2018-2023 EvaDB
3
#
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
# you may not use this file except in compliance with the License.
6
# You may obtain a copy of the License at
7
#
8
#     http://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15
from dataclasses import dataclass
2✔
16
from pathlib import Path
2✔
17
from typing import TYPE_CHECKING, Callable
2✔
18

19
from evadb.catalog.catalog_utils import get_catalog_instance
2✔
20
from evadb.configuration.configuration_manager import ConfigurationManager
2✔
21
from evadb.configuration.constants import DB_DEFAULT_NAME, EvaDB_DATABASE_DIR
2✔
22
from evadb.utils.generic_utils import parse_config_yml
2✔
23

24
if TYPE_CHECKING:
25
    from evadb.catalog.catalog_manager import CatalogManager
26

27

28
@dataclass
2✔
29
class EvaDBDatabase:
2✔
30
    db_uri: str
2✔
31
    config: ConfigurationManager
2✔
32
    catalog_uri: str
2✔
33
    catalog_func: Callable
2✔
34

35
    def catalog(self) -> "CatalogManager":
2✔
36
        """
37
        Note: Generating an object on demand plays a crucial role in ensuring that different threads do not share the same catalog object, as it can result in serialization issues and incorrect behavior with SQLAlchemy. Refer to get_catalog_instance()
38
        """
39
        return self.catalog_func(self.catalog_uri, self.config)
2✔
40

41

42
def get_default_db_uri(evadb_dir: Path):
2✔
43
    config_obj = parse_config_yml()
2✔
44
    if config_obj["core"]["catalog_database_uri"]:
2✔
45
        return config_obj["core"]["catalog_database_uri"]
×
46
    else:
47
        # Default to sqlite.
48
        return f"sqlite:///{evadb_dir.resolve()}/{DB_DEFAULT_NAME}"
2✔
49

50

51
def init_evadb_instance(
2✔
52
    db_dir: str, host: str = None, port: int = None, custom_db_uri: str = None
53
):
54
    if db_dir is None:
2✔
55
        db_dir = EvaDB_DATABASE_DIR
1✔
56
    config = ConfigurationManager(db_dir)
2✔
57

58
    catalog_uri = custom_db_uri or get_default_db_uri(Path(db_dir))
2✔
59

60
    return EvaDBDatabase(db_dir, config, catalog_uri, get_catalog_instance)
2✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc