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

georgia-tech-db / eva / #758

04 Sep 2023 08:37PM UTC coverage: 0.0% (-78.3%) from 78.333%
#758

push

circle-ci

hershd23
Increased underline length in at line 75 in text_summarization.rst
	modified:   docs/source/benchmarks/text_summarization.rst

0 of 11303 relevant lines covered (0.0%)

0.0 hits per line

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

0.0
/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
×
16
from pathlib import Path
×
17
from typing import TYPE_CHECKING, Callable
×
18

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

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

27

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

35
    def catalog(self) -> "CatalogManager":
×
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)
×
40

41

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

50

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

58
    catalog_uri = custom_db_uri or get_default_db_uri(Path(db_dir))
×
59

60
    return EvaDBDatabase(db_dir, config, catalog_uri, get_catalog_instance)
×
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

© 2025 Coveralls, Inc