Issues (10)

pystratum_common/MetadataDataLayer.py (1 issue)

1
import os
2
3
from pystratum_backend.StratumStyle import StratumStyle
4
5
6 View Code Duplication
class MetadataDataLayer:
0 ignored issues
show
This code seems to be duplicated in your project.
Loading history...
7
    """
8
    Data layer for retrieving metadata and loading stored routines.
9
    """
10
11
    # ------------------------------------------------------------------------------------------------------------------
12
    def __init__(self, io: StratumStyle):
13
        """
14
        Object constructor.
15
16
        :param PyStratumStyle io: The output decorator.
17
        """
18
19
        self._io: StratumStyle = io
20
        """
21
        The output decorator.
22
        """
23
24
    # ------------------------------------------------------------------------------------------------------------------
25
    def _log_query(self, query: str) -> None:
26
        """
27
        Logs the query on the console.
28
29
        :param str query: The query.
30
        """
31
        query = query.strip()
32
33
        if os.linesep in query:
34
            # Query is a multi line query
35
            self._io.log_very_verbose('Executing query:')
36
            self._io.log_very_verbose('<sql>{0}</sql>'.format(query))
37
        else:
38
            # Query is a single line query.
39
            self._io.log_very_verbose('Executing query: <sql>{0}</sql>'.format(query))
40
41
# ----------------------------------------------------------------------------------------------------------------------
42