|
8 | 8 |
|
9 | 9 | # DEPRECATED |
10 | 10 |
|
| 11 | + |
11 | 12 | @click.command() |
12 | 13 | @click.argument("inputs", nargs=-1) |
13 | 14 | @click.option("--index/--no-index", default=True, help="Create indexes on each column") |
|
16 | 17 | "-n", |
17 | 18 | help="Name of class/view to materialize. If blank, will perform for ALL", |
18 | 19 | ) |
19 | | -def cli(inputs, name: str, index: bool, combinatorial: bool=False): |
| 20 | +def cli(inputs, name: str, index: bool, combinatorial: bool = False): |
20 | 21 | """ |
21 | 22 | Generates a command that turns a view into a table |
22 | 23 |
|
@@ -45,12 +46,15 @@ def cli(inputs, name: str, index: bool, combinatorial: bool=False): |
45 | 46 | raise ValueError("Cannot use combinatorial without index") |
46 | 47 | s = sv.class_slots(cn) |
47 | 48 | powerset = itertools.chain.from_iterable( |
48 | | - itertools.combinations(s, r) for r in range(len(s) + 1)) |
| 49 | + itertools.combinations(s, r) for r in range(len(s) + 1) |
| 50 | + ) |
49 | 51 | for sns in powerset: |
50 | 52 | colnames = [underscore(sn) for sn in sns] |
51 | | - colnames_str = '_'.join(colnames) |
52 | | - colnames_commasep = ','.join(colnames) |
53 | | - print(f"CREATE INDEX {tn}_{colnames_str} ON {tn}({colnames_commasep});") |
| 53 | + colnames_str = "_".join(colnames) |
| 54 | + colnames_commasep = ",".join(colnames) |
| 55 | + print( |
| 56 | + f"CREATE INDEX {tn}_{colnames_str} ON {tn}({colnames_commasep});" |
| 57 | + ) |
54 | 58 |
|
55 | 59 |
|
56 | 60 | if __name__ == "__main__": |
|
0 commit comments