Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
cmungall committed Apr 29, 2024
1 parent 9a95f2e commit 9a32486
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/semsql/sqlutils/view2table.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

# DEPRECATED


@click.command()
@click.argument("inputs", nargs=-1)
@click.option("--index/--no-index", default=True, help="Create indexes on each column")
Expand All @@ -16,7 +17,7 @@
"-n",
help="Name of class/view to materialize. If blank, will perform for ALL",
)
def cli(inputs, name: str, index: bool, combinatorial: bool=False):
def cli(inputs, name: str, index: bool, combinatorial: bool = False):
"""
Generates a command that turns a view into a table
Expand Down Expand Up @@ -45,12 +46,15 @@ def cli(inputs, name: str, index: bool, combinatorial: bool=False):
raise ValueError("Cannot use combinatorial without index")
s = sv.class_slots(cn)
powerset = itertools.chain.from_iterable(
itertools.combinations(s, r) for r in range(len(s) + 1))
itertools.combinations(s, r) for r in range(len(s) + 1)
)
for sns in powerset:
colnames = [underscore(sn) for sn in sns]
colnames_str = '_'.join(colnames)
colnames_commasep = ','.join(colnames)
print(f"CREATE INDEX {tn}_{colnames_str} ON {tn}({colnames_commasep});")
colnames_str = "_".join(colnames)
colnames_commasep = ",".join(colnames)
print(
f"CREATE INDEX {tn}_{colnames_str} ON {tn}({colnames_commasep});"
)


if __name__ == "__main__":
Expand Down

0 comments on commit 9a32486

Please sign in to comment.