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

georgia-tech-db / eva / #850

08 Nov 2023 08:36PM UTC coverage: 0.0% (-77.0%) from 76.982%
#850

push

circleci

americast
fix metrics logic

0 of 1 new or added line in 1 file covered. (0.0%)

9789 existing lines in 252 files now uncovered.

0 of 12428 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/parser/insert_statement.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.
UNCOV
15
from typing import List
×
16

UNCOV
17
from evadb.expression.abstract_expression import AbstractExpression
×
UNCOV
18
from evadb.parser.statement import AbstractStatement
×
UNCOV
19
from evadb.parser.table_ref import TableRef
×
UNCOV
20
from evadb.parser.types import StatementType
×
21

22

UNCOV
23
class InsertTableStatement(AbstractStatement):
×
24
    """
25
    Insert Table Statement constructed after parsing the input query
26

27
    Attributes
28
    ----------
29
    TableRef:
30
        table reference in the insert table statement
31
    ColumnList:
32
        list of columns
33
    ValueList:
34
        list of values to fill
35
    """
36

UNCOV
37
    def __init__(
×
38
        self,
39
        table_ref: TableRef,
40
        column_list: List[AbstractExpression] = None,
41
        value_list: List[AbstractExpression] = None,
42
    ):
UNCOV
43
        super().__init__(StatementType.INSERT)
×
UNCOV
44
        self._table_ref = table_ref
×
UNCOV
45
        self._column_list = column_list
×
UNCOV
46
        self._value_list = value_list
×
47

UNCOV
48
    def __str__(self) -> str:
×
UNCOV
49
        column_list_str = ""
×
UNCOV
50
        if self._column_list is not None:
×
UNCOV
51
            for expr in self._column_list:
×
UNCOV
52
                column_list_str += str(expr) + ", "
×
UNCOV
53
            column_list_str = column_list_str.rstrip(", ")
×
54

UNCOV
55
        value_list_str = ""
×
UNCOV
56
        if self._value_list is not None:
×
UNCOV
57
            for expr in self._value_list:
×
UNCOV
58
                value_list_str += str(expr) + ", "
×
UNCOV
59
            value_list_str = value_list_str.rstrip(", ")
×
60

UNCOV
61
        print_str = "INSERT INTO {}({}) VALUES ({}) ".format(
×
62
            self._table_ref, column_list_str, value_list_str
63
        )
UNCOV
64
        return print_str
×
65

UNCOV
66
    @property
×
UNCOV
67
    def table_ref(self) -> TableRef:
×
UNCOV
68
        return self._table_ref
×
69

UNCOV
70
    @property
×
UNCOV
71
    def column_list(self) -> List[AbstractExpression]:
×
UNCOV
72
        return self._column_list
×
73

UNCOV
74
    @property
×
UNCOV
75
    def value_list(self) -> List[AbstractExpression]:
×
UNCOV
76
        return self._value_list
×
77

UNCOV
78
    def __eq__(self, other):
×
UNCOV
79
        if not isinstance(other, InsertTableStatement):
×
UNCOV
80
            return False
×
UNCOV
81
        return (
×
82
            self.table_ref == other.table_ref
83
            and self.column_list == other.column_list
84
            and self.value_list == other.value_list
85
        )
86

UNCOV
87
    def __hash__(self) -> int:
×
UNCOV
88
        return hash(
×
89
            (
90
                super().__hash__(),
91
                self.table_ref,
92
                tuple(self.column_list),
93
                tuple(self.value_list),
94
            )
95
        )
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