-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobjects.py
50 lines (35 loc) · 1.1 KB
/
objects.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
'''
Created on Sep 25, 2017
@author: rclaus
'''
import quickstep as q
class Table:
def __init__(self,name,columns):
self.columns=columns
self.name=name
def size(self):
return tableSize(self.name)
def copyReference(self):
return Table(self.name,self.columns)
def toString(self):
return printTable(self.name)
class Literal:
def __init__(self,table,columns,columnMapping):
self.name=table
self.columnMapping=columnMapping
self.columns=columns
self.score=-1
def setScore(self,score):
self.score=score
def getScore(self):
return self.score
def size(self):
return tableSize(self.name)
def copyReference(self):
return Literal(self.name,self.columns,self.columnMapping)
def toString(self):
return printTable(self.name)
def tableSize(tableName):
return int(q.sql_to_table("SELECT COUNT(*) AS c FROM "+tableName).iloc[0]['c'])
def printTable(name):
return q.sql_to_table("SELECT * FROM "+name+";")