Edit on GitHub

bin.Databases.SampleDatabase

 1from Databases.database import Database
 2
 3
 4class SampleDatabase(Database):
 5
 6    name = "SampleDatabase"
 7    """This variable is used for configuration file
 8
 9    You must specify it in config to load an instance"""
10
11    def __init__(self, config):
12        """config contains parameters given in etc/config.cfg file"""
13        super().__init__()
14
15    def start(self):
16        """Create Table or anything else"""
17        pass
18
19    def stop(self):
20        pass
21
22    ###############
23    #   INSERTS   #
24    ###############
25
26    def save(self, record):
27        """All records are sent one by one using this function"""
28        pass
29
30    ##############
31    #   GETTER   #
32    ##############
33    # The followings aren't used
34
35    def get(
36        self,
37        time_start,
38        time_end,
39        record_type=None,
40        peer_asn=None,
41        collectors=None,
42        countries=None,
43        as_numbers=None,
44        prefixes=None,
45        as_paths=None,
46    ):
47        """
48        Retrieve data and return it as iterable
49
50        See `Database.get()`
51        """
52        pass
class SampleDatabase(Databases.database.Database):
 5class SampleDatabase(Database):
 6
 7    name = "SampleDatabase"
 8    """This variable is used for configuration file
 9
10    You must specify it in config to load an instance"""
11
12    def __init__(self, config):
13        """config contains parameters given in etc/config.cfg file"""
14        super().__init__()
15
16    def start(self):
17        """Create Table or anything else"""
18        pass
19
20    def stop(self):
21        pass
22
23    ###############
24    #   INSERTS   #
25    ###############
26
27    def save(self, record):
28        """All records are sent one by one using this function"""
29        pass
30
31    ##############
32    #   GETTER   #
33    ##############
34    # The followings aren't used
35
36    def get(
37        self,
38        time_start,
39        time_end,
40        record_type=None,
41        peer_asn=None,
42        collectors=None,
43        countries=None,
44        as_numbers=None,
45        prefixes=None,
46        as_paths=None,
47    ):
48        """
49        Retrieve data and return it as iterable
50
51        See `Database.get()`
52        """
53        pass

Helper class that provides a standard way to create an ABC using inheritance.

SampleDatabase(config)
12    def __init__(self, config):
13        """config contains parameters given in etc/config.cfg file"""
14        super().__init__()

config contains parameters given in etc/config.cfg file

name = 'SampleDatabase'

This variable is used for configuration file

You must specify it in config to load an instance

def start(self):
16    def start(self):
17        """Create Table or anything else"""
18        pass

Create Table or anything else

def stop(self):
20    def stop(self):
21        pass
def save(self, record):
27    def save(self, record):
28        """All records are sent one by one using this function"""
29        pass

All records are sent one by one using this function

def get( self, time_start, time_end, record_type=None, peer_asn=None, collectors=None, countries=None, as_numbers=None, prefixes=None, as_paths=None):
36    def get(
37        self,
38        time_start,
39        time_end,
40        record_type=None,
41        peer_asn=None,
42        collectors=None,
43        countries=None,
44        as_numbers=None,
45        prefixes=None,
46        as_paths=None,
47    ):
48        """
49        Retrieve data and return it as iterable
50
51        See `Database.get()`
52        """
53        pass

Retrieve data and return it as iterable

See Database.get()