Skip to content

Commit 097cb39

Browse files
committed
Combine _lineage_table_sql into ensure_lineage_table
1 parent fe58e00 commit 097cb39

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/datajoint/lineage.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,18 @@
1717
LINEAGE_TABLE_NAME = "~lineage"
1818

1919

20-
def _lineage_table_sql(database):
21-
"""Generate SQL to create the ~lineage table."""
22-
return f"""
20+
def ensure_lineage_table(connection, database):
21+
"""Create the ~lineage table if it doesn't exist."""
22+
connection.query(
23+
f"""
2324
CREATE TABLE IF NOT EXISTS `{database}`.`{LINEAGE_TABLE_NAME}` (
2425
table_name VARCHAR(64) NOT NULL,
2526
attribute_name VARCHAR(64) NOT NULL,
2627
lineage VARCHAR(255) NOT NULL,
2728
PRIMARY KEY (table_name, attribute_name)
2829
) ENGINE=InnoDB
29-
"""
30-
31-
32-
def ensure_lineage_table(connection, database):
33-
"""Create the ~lineage table if it doesn't exist."""
34-
connection.query(_lineage_table_sql(database))
30+
"""
31+
)
3532

3633

3734
def lineage_table_exists(connection, database):

0 commit comments

Comments
 (0)