|
1 | 1 |
|
2 | 2 | import decimal
|
3 |
| -import re |
4 | 3 | from typing import List, Optional, Set
|
5 | 4 |
|
6 | 5 | import agate
|
@@ -47,21 +46,24 @@ def rename_relation(self, from_relation, to_relation):
|
47 | 46 | elif existing_relation_type == 'view':
|
48 | 47 |
|
49 | 48 | result = self.connections.execute(f"""
|
50 |
| - SELECT sql FROM {from_relation.schema}.sqlite_master WHERE type = 'view' and name = '{from_relation.identifier}' |
| 49 | + SELECT sql FROM {from_relation.schema}.sqlite_master |
| 50 | + WHERE type = 'view' and name = '{from_relation.identifier}' |
51 | 51 | """, fetch=True)
|
52 | 52 |
|
53 | 53 | definition = result[1].rows[0][0]
|
54 | 54 |
|
55 |
| - self.connections.execute(f"DROP VIEW {from_relation}"); |
| 55 | + self.connections.execute(f"DROP VIEW {from_relation}") |
56 | 56 |
|
57 |
| - self.connections.execute(f"DROP VIEW IF EXISTS {to_relation}"); |
| 57 | + self.connections.execute(f"DROP VIEW IF EXISTS {to_relation}") |
58 | 58 |
|
59 | 59 | new_definition = definition.replace(from_relation.identifier, f"{to_relation}", 1)
|
60 | 60 |
|
61 | 61 | self.connections.execute(new_definition)
|
62 | 62 |
|
63 | 63 | else:
|
64 |
| - raise NotImplementedException(f"I don't know how to rename this type of relation: {from_relation.type}, from: {from_relation}, to: {to_relation}") |
| 64 | + raise NotImplementedException( |
| 65 | + f"I don't know how to rename this type of relation: {from_relation.type}," + |
| 66 | + f" from: {from_relation}, to: {to_relation}") |
65 | 67 |
|
66 | 68 | def list_schemas(self, database: str) -> List[str]:
|
67 | 69 | """
|
@@ -143,7 +145,7 @@ def _get_one_catalog(
|
143 | 145 |
|
144 | 146 | for relation_row in results[1]:
|
145 | 147 | name = relation_row['name']
|
146 |
| - relation_type= relation_row['data_type'] |
| 148 | + relation_type = relation_row['data_type'] |
147 | 149 |
|
148 | 150 | table_info = self.connections.execute(
|
149 | 151 | f"pragma {schema}.table_info({name})", fetch=True)
|
|
0 commit comments