Skip to content

Commit

Permalink
Fixed a bug when select_all() is used without exclude()
Browse files Browse the repository at this point in the history
  • Loading branch information
carlvoller committed Sep 10, 2024
1 parent 7bfa206 commit c7bf9c9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ members = ["crates/*", "py-excel-rs"]
resolver = "2"

[workspace.package]
version = "0.5.0"
version = "0.5.1"
authors = ["Carl Voller"]
edition = "2021"
homepage = "https://github.com/carlvoller/excel-rs"
license = "MIT"
repository = "https://github.com/carlvoller/excel-rs"

[workspace.dependencies]
excel-rs-xlsx = { version = "0.5.0", path = "crates/excel-rs-xlsx", default-features = false }
excel-rs-csv = { version = "0.5.0", path = "crates/excel-rs-csv", default-features = false }
excel-rs-postgres = { version = "0.5.0", path = "crates/excel-rs-postgres", default-features = false }
excel-rs-xlsx = { version = "0.5.1", path = "crates/excel-rs-xlsx", default-features = false }
excel-rs-csv = { version = "0.5.1", path = "crates/excel-rs-csv", default-features = false }
excel-rs-postgres = { version = "0.5.1", path = "crates/excel-rs-postgres", default-features = false }

[profile.release]
opt-level = 3
Expand Down
8 changes: 5 additions & 3 deletions py-excel-rs/py_excel_rs/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,19 @@ def execute(self):
table_name = schema_name
schema_name = ""

columns = [f"\"{x}\"" for x in client.get_columns(table_name, schema_name, self._excluded)]
if self._selected == "*":
query = f"SELECT {', '.join(columns)} FROM {self._table_name}"
if self._excluded is not None:
columns = [f"\"{x}\"" for x in client.get_columns(table_name, schema_name, self._excluded)]
query = f"SELECT {', '.join(columns)} FROM {self._table_name}"
else:
query = f"SELECT * FROM {self._table_name}"
else:
parsed = [f"'{x}'" for x in self._selected]
query = f"SELECT {', '.join(parsed)} FROM {self._table_name}"

if self._order_by is not None and self._order_by_col is not None:
query += f" ORDER BY \"{self._order_by_col}\" {self._order_by.value}"


xlsx = client.get_xlsx_from_query(query)
client.close()
return xlsx
Expand Down
2 changes: 1 addition & 1 deletion py-excel-rs/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "maturin"

[project]
name = "py-excel-rs"
version = "0.5.0"
version = "0.5.1"
description = "Some performant utility functions to convert common data structures to XLSX"
dependencies = ["pandas", "numpy"]
requires-python = ">=3.7"
Expand Down

0 comments on commit c7bf9c9

Please sign in to comment.