• 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/third_party/databases/types.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

17
import pandas as pd
×
18

19

20
@dataclass
×
21
class DBHandlerResponse:
×
22
    """
23
    Represents the response from a database handler containing data and an optional error message.
24

25
    Attributes:
26
        data (pd.DataFrame): A Pandas DataFrame containing the data retrieved from the database.
27
        error (str, optional): An optional error message indicating any issues encountered during the operation.
28
    """
29

30
    data: pd.DataFrame
×
31
    error: str = None
×
32

33

34
@dataclass
×
35
class DBHandlerStatus:
×
36
    """
37
    Represents the status of a database handler operation, along with an optional error message.
38

39
    Attributes:
40
        status (bool): A boolean indicating the success (True) or failure (False) of the operation.
41
        error (str, optional): An optional error message providing details about any errors that occurred.
42
    """
43

44
    status: bool
×
45
    error: str = None
×
46

47

48
class DBHandler:
×
49
    """
50
    Base class for handling database operations.
51

52
    Args:
53
        name (str): The name associated with the database handler instance.
54
    """
55

56
    def __init__(self, name: str, **kwargs):
×
57
        self.name = name
×
58
        self.connection = None
×
59

60
    def connect(self):
×
61
        """
62
        Establishes a connection to the database.
63

64
        Raises:
65
            NotImplementedError: This method should be implemented in derived classes.
66
        """
67
        raise NotImplementedError()
68

69
    def disconnect(self):
×
70
        """
71
        Disconnects from the database.
72

73
        This method can be overridden in derived classes to perform specific disconnect actions.
74
        """
75
        raise NotImplementedError()
76

77
    def check_connection(self) -> DBHandlerStatus:
×
78
        """
79
        Checks the status of the database connection.
80

81
        Returns:
82
            DBHandlerStatus: An instance of DBHandlerStatus indicating the connection status.
83

84
        Raises:
85
            NotImplementedError: This method should be implemented in derived classes.
86
        """
87
        raise NotImplementedError()
88

89
    def get_tables(self) -> DBHandlerResponse:
×
90
        """
91
        Retrieves the list of tables from the database.
92

93
        Returns:
94
            DBHandlerResponse: An instance of DBHandlerResponse containing the list of tables or an error message. Data is in a pandas DataFrame.
95

96
        Raises:
97
            NotImplementedError: This method should be implemented in derived classes.
98
        """
99
        raise NotImplementedError()
100

101
    def get_columns(self, table_name: str) -> DBHandlerResponse:
×
102
        """
103
        Retrieves the columns of a specified table from the database.
104

105
        Args:
106
            table_name (str): The name of the table for which to retrieve columns.
107

108
        Returns:
109
            DBHandlerResponse: An instance of DBHandlerResponse containing the columns or an error message. Data is in a pandas DataFrame. It should have the following two columns: name and dtype. The dtype should be a Python dtype and will default to `str`.
110

111
        Raises:
112
            NotImplementedError: This method should be implemented in derived classes.
113
        """
114
        raise NotImplementedError()
115

116
    def execute_native_query(self, query_string: str) -> DBHandlerResponse:
×
117
        """
118
        Executes the query through the handler's database engine.
119

120
        Args:
121
            query_string (str): The string representation of the native query.
122

123
        Returns:
124
            DBHandlerResponse: An instance of DBHandlerResponse containing the columns or an error message. Data is in a pandas DataFrame.
125

126
        Raises:
127
            NotImplementedError: This method should be implemented in derived classes.
128
        """
129
        raise NotImplementedError()
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