tangled
alpha
login
or
join now
bernsteinbear.com
/
db.py
0
fork
atom
this repo has no description
0
fork
atom
overview
issues
pulls
pipelines
authored by
Max Bernstein
and committed by
GitHub
2 years ago
f7bf4a09
e65d8e7d
+5
-8
1 changed file
expand all
collapse all
unified
split
db.py
+5
-8
db.py
···
119
119
120
120
def DISTINCT(self, table, columns):
121
121
_distinct = {US.join(str(row[col]) for col in columns): row for row in table.rows}
122
122
-
newRows = []
123
123
-
for key in _distinct:
124
124
-
newRow = {}
125
125
-
for col in columns:
126
126
-
newRow[col] = _distinct[key][col]
127
127
-
newRows.append(newRow)
128
128
-
return Table(table.name, newRows)
122
122
+
return Table(table.name, [
123
123
+
{col: _distinct[key][col] for col in columns}
124
124
+
for key in _distinct
125
125
+
])
129
126
130
127
131
128
def __repr__(self):
···
157
154
158
155
159
156
result = User
160
160
-
result = db.UPDATE(User, {"name": "CHUCK"}, lambda row: row["id"] == 2)
157
157
+
# result = db.UPDATE(User, {"name": "CHUCK"}, lambda row: row["id"] == 2)
161
158
result = db.DISTINCT(result, ["name"])
162
159
print(result)