Skip to content

Commit

Permalink
Merge pull request #20 from monarch-initiative/duckdb-update
Browse files Browse the repository at this point in the history
Update to duckdb 0.10.2, fix casting of boolean to string (likely due to better auto-typing in duckdb's read_csv).
  • Loading branch information
kevinschaper authored Apr 26, 2024
2 parents 1df1308 + 384049a commit e8715fe
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 57 deletions.
4 changes: 3 additions & 1 deletion closurizer/closurizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,18 @@ def node_joins(predicate):
on {field}_edges.object = {field}_closure_label.id
"""


def grouping_key(grouping_fields):
fragments = []
for field in grouping_fields:
if field == 'negated':
fragments.append(f"coalesce({field}.replace('True','NOT'), '')")
fragments.append(f"coalesce(cast({field} as varchar).replace('true','NOT'), '')")
else:
fragments.append(field)
grouping_key_fragments = ", ".join(fragments)
return f"concat_ws('|', {grouping_key_fragments}) as grouping_key"


def add_closure(kg_archive: str,
closure_file: str,
nodes_output_file: str,
Expand Down
107 changes: 52 additions & 55 deletions poetry.lock

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

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ authors = ["Kevin Schaper <[email protected]>"]
python = "^3.8"
click = "^8"
SQLAlchemy = "^1.4.37"
duckdb = "^0.9.1"
duckdb = "^0.10.2"

[tool.poetry.dev-dependencies]

Expand Down

0 comments on commit e8715fe

Please sign in to comment.