Skip to content

Commit

Permalink
Merge pull request #6 from dfds-data/feat/column-names
Browse files Browse the repository at this point in the history
Feat/column names
  • Loading branch information
martimors authored Mar 29, 2021
2 parents 2e86bc5 + 76cb0a6 commit 905a01f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion denodoclient/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@

__author__ = """Martin Morset"""
__email__ = "[email protected]"
__version__ = "__version__ = '0.2.0'"
__version__ = "0.3.0"
4 changes: 2 additions & 2 deletions denodoclient/dataframes/denododataframeclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ def to_dataframe(self, chunksize: int = None):
return self._chunkwise_rows_to_dataframe(chunksize)

def _all_rows_to_dataframe(self) -> pd.DataFrame:
return pd.DataFrame((tuple(t) for t in self._cursor.fetchall()))
return pd.DataFrame((tuple(t) for t in self._cursor.fetchall()), columns=self.columns)

def _chunkwise_rows_to_dataframe(self, chunksize) -> Iterable[pd.DataFrame]:
rows = self._cursor.fetchmany(chunksize)
while rows:
yield pd.DataFrame(tuple(t) for t in rows)
yield pd.DataFrame((tuple(t) for t in rows), columns=self.columns)
rows = self._cursor.fetchmany(chunksize)
4 changes: 4 additions & 0 deletions denodoclient/denodoclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,7 @@ def query(self, query: VqlQuery):
@property
def cursor(self):
return self._cursor

@property
def columns(self):
return [description[0] for description in self._cursor.description]
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.2.0
current_version = 0.3.0
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@
test_suite="tests",
tests_require=test_requirements,
url="https://github.com/dfds-data/denodoclient",
version="0.2.0",
version="0.3.0",
zip_safe=False,
)

0 comments on commit 905a01f

Please sign in to comment.