Skip to content

Commit

Permalink
Merge pull request #13 from pepkit/dev
Browse files Browse the repository at this point in the history
v0.2.0
  • Loading branch information
xuebingjie1990 authored Oct 25, 2021
2 parents 8624ba7 + 5441938 commit ee8cf6d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
6 changes: 6 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format.

## [0.2.0] - 2021-10-25

### Added

- optional parameter for specify returning columns with `select_txt`

## [0.1.0] - 2021-06-24

**This update introduces some backwards-incompatible changes due to database interface redesign**
Expand Down
2 changes: 1 addition & 1 deletion pipestat/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1.0"
__version__ = "0.2.0"
15 changes: 10 additions & 5 deletions pipestat/pipestat.py
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,7 @@ def _retrieve_db(

def select_txt(
self,
columns: Optional[List[str]] = None,
filter_templ: Optional[str] = "",
filter_params: Optional[Dict[str, Any]] = {},
table_name: Optional[str] = None,
Expand All @@ -1232,12 +1233,16 @@ def select_txt(
f"The {self.__class__.__name__} object is not backed by a database. "
f"This operation is not supported for file backend."
)
ORM = self.get_orm(table_name or self.namespace)
with self.session as s:
q = (
s.query(self.get_orm(table_name or self.namespace))
.filter(text(filter_templ))
.params(**filter_params)
)
if columns is not None:
q = (
s.query(*[getattr(ORM, column) for column in columns])
.filter(text(filter_templ))
.params(**filter_params)
)
else:
q = s.query(ORM).filter(text(filter_templ)).params(**filter_params)
if isinstance(offset, int):
q = q.offset(offset)
if isinstance(limit, int):
Expand Down

0 comments on commit ee8cf6d

Please sign in to comment.