-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsqlite3_sql.py
More file actions
48 lines (33 loc) · 1.17 KB
/
sqlite3_sql.py
File metadata and controls
48 lines (33 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# sqlite3_sql.py
from frame_obj import asbool, aslist
from frames_db import sqlite3_db as get_db
from sql_generator import (
separate, gen, database as sql_gen_database, schema as sql_gen_schema,
table as sql_gen_table, column, sql_type, table_constraint, index
);
class database(sql_gen_database):
can_alter_database = False
def create(self, outfile):
if hasattr(self.database, 'schema'):
#print(f"database.create, gen(schema, {len(self.database.schema)}")
gen(schema, self.database.schema, outfile)
class schema(sql_gen_schema):
default_name = 'main'
can_alter_schema = False
def create_schema_ddl(self, outfile):
r'''Writes trailing ';\n'
'''
pass
class table(sql_gen_table):
can_alter_table_schema = False
can_alter_table_name = True
can_alter_column_name = True
can_alter_column = False
can_drop_column = False
can_add_column = True
can_alter_index = False
def create_options(self, outfile):
r'''Writes initial space, no termination.
'''
if not asbool(getattr(self.table, 'with_oid', 'true')):
outfile.write(" WITHOUT ROWID")