We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fe58e00 commit 097cb39Copy full SHA for 097cb39
1 file changed
src/datajoint/lineage.py
@@ -17,21 +17,18 @@
17
LINEAGE_TABLE_NAME = "~lineage"
18
19
20
-def _lineage_table_sql(database):
21
- """Generate SQL to create the ~lineage table."""
22
- return f"""
+def ensure_lineage_table(connection, database):
+ """Create the ~lineage table if it doesn't exist."""
+ connection.query(
23
+ f"""
24
CREATE TABLE IF NOT EXISTS `{database}`.`{LINEAGE_TABLE_NAME}` (
25
table_name VARCHAR(64) NOT NULL,
26
attribute_name VARCHAR(64) NOT NULL,
27
lineage VARCHAR(255) NOT NULL,
28
PRIMARY KEY (table_name, attribute_name)
29
) ENGINE=InnoDB
- """
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))
+ """
+ )
35
36
37
def lineage_table_exists(connection, database):
0 commit comments