Alphabetize _extract_table_name.
This commit is contained in:
parent
c930228d3f
commit
0852630cd1
1 changed files with 8 additions and 6 deletions
|
@ -42,6 +42,7 @@ FILENAME_BADCHARS = '\\/:*?<>|"'
|
||||||
# Note: Setting user_version pragma in init sequence is safe because it only
|
# Note: Setting user_version pragma in init sequence is safe because it only
|
||||||
# happens after the out-of-date check occurs, so no chance of accidentally
|
# happens after the out-of-date check occurs, so no chance of accidentally
|
||||||
# overwriting it.
|
# overwriting it.
|
||||||
|
|
||||||
DATABASE_VERSION = 14
|
DATABASE_VERSION = 14
|
||||||
DB_PRAGMAS = f'''
|
DB_PRAGMAS = f'''
|
||||||
PRAGMA cache_size = 10000;
|
PRAGMA cache_size = 10000;
|
||||||
|
@ -49,6 +50,7 @@ PRAGMA count_changes = OFF;
|
||||||
PRAGMA foreign_keys = ON;
|
PRAGMA foreign_keys = ON;
|
||||||
PRAGMA user_version = {DATABASE_VERSION};
|
PRAGMA user_version = {DATABASE_VERSION};
|
||||||
'''
|
'''
|
||||||
|
|
||||||
DB_INIT = f'''
|
DB_INIT = f'''
|
||||||
{DB_PRAGMAS}
|
{DB_PRAGMAS}
|
||||||
|
|
||||||
|
@ -192,6 +194,12 @@ def _extract_columns(create_table_statement):
|
||||||
column_names = [c for c in column_names if c.lower() != 'foreign']
|
column_names = [c for c in column_names if c.lower() != 'foreign']
|
||||||
return column_names
|
return column_names
|
||||||
|
|
||||||
|
def _extract_table_name(create_table_statement):
|
||||||
|
# CREATE TABLE table_name(
|
||||||
|
table_name = create_table_statement.split('(')[0].strip()
|
||||||
|
table_name = table_name.split()[-1]
|
||||||
|
return table_name
|
||||||
|
|
||||||
def _extract_table_statements(script):
|
def _extract_table_statements(script):
|
||||||
for statement in script.split(';'):
|
for statement in script.split(';'):
|
||||||
if 'create table' not in statement.lower():
|
if 'create table' not in statement.lower():
|
||||||
|
@ -199,12 +207,6 @@ def _extract_table_statements(script):
|
||||||
|
|
||||||
yield statement
|
yield statement
|
||||||
|
|
||||||
def _extract_table_name(create_table_statement):
|
|
||||||
# CREATE TABLE table_name(
|
|
||||||
table_name = create_table_statement.split('(')[0].strip()
|
|
||||||
table_name = table_name.split()[-1]
|
|
||||||
return table_name
|
|
||||||
|
|
||||||
def _reverse_index(columns):
|
def _reverse_index(columns):
|
||||||
'''
|
'''
|
||||||
A dictionary where the key is the item and the value is the index.
|
A dictionary where the key is the item and the value is the index.
|
||||||
|
|
Loading…
Reference in a new issue