-
Notifications
You must be signed in to change notification settings - Fork 9
/
DBStuffAPI.py
67 lines (48 loc) · 1.69 KB
/
DBStuffAPI.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
from pymongo import MongoClient
class LngLatDB:
def __init__(self):
self.db = MongoClient().routel
def add_to_db(self, row):
self.db.lnglat.insert(row)
def get_data(self, query_dict):
return list(self.db.lnglat.find(query_dict))
def get_all(self):
return list(self.db.lnglat.find())
def remove(self):
self.db.lnglat.remove()
return
class LngLatCostDB:
def __init__(self):
self.db = MongoClient().routely
pass
def add_to_db(self, row):
self.db.lnglatcost.insert(row)
def get_data(self, query_dict):
return list(self.db.lnglatcost.find(query_dict))
def get_distinct(self, query_dict):
return list(self.db.lnglatcost.distinct(query_dict))
def get_all(self):
return list(self.db.lnglatcost.find())
def remove(self):
self.db.lnglatcost.remove()
return
class ElementLngLatCostDB:
def __init__(self):
self.db = MongoClient().routely
pass
def add_to_db(self, row):
self.db.element_lng_lat_db.insert(row)
def get_data(self,query_dict,pat):
return list(self.db.element_lng_lat_db.find(query_dict, pat))
def get_data_2(self, query_dict):
return list(self.db.element_lng_lat_db.find(query_dict))
def remove(self):
self.db.element_lng_lat_db.remove()
return
# db = MongoClient().routely
# def add_to_db(start_point , end_point , distance, time):
# db.things.insert({"start_point": start_point,"end_point": end_point,"distance": distance,"time": time })
#
#
# def get_data(start_point, end_point):
# return list(db.things.find({"start_point": start_point,"end_point": end_point}))