Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pykern/sql_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def rollback(self):
self.commit_or_rollback(commit=False)

def select(self, table_or_stmt, where=None):
return self.__execute_table_or_stmt("select", table_or_stmt, where)
return self.__execute_table_or_stmt("select", table_or_stmt, where).mappings()

def select_max_primary_id(self, table):
w = self.meta._table_wrap(table)
Expand Down
3 changes: 3 additions & 0 deletions tests/sql_db_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,15 @@ def _meta(dir_path):

def _selects(meta):
from pykern import pkunit, pkdebug
from pykern.pkcollections import PKDict
import sqlalchemy

with meta.session() as s:
r = s.select_one("t1", where=dict(a_name="Mildred"))
pkunit.pkeq("hitch hiker's guide", r.a_text)
t1, t2 = s.t.t1, s.t.t2
d = PKDict(r)
pkunit.pkeq(t1.c.keys(), list(d.keys()))
r = s.execute(
sqlalchemy.select(
t1,
Expand Down