generated from dopt-python/py311
change database structure for initial recording of individual persons
This commit is contained in:
19
prototypes/db_alter.py
Normal file
19
prototypes/db_alter.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# %%
|
||||
import sqlalchemy as sql
|
||||
|
||||
from wce_crm import db
|
||||
|
||||
# %%
|
||||
stmt = sql.text(
|
||||
"ALTER TABLE grunderfassung_unternehmen ADD COLUMN Metadaten_wiedereintrittsdatum DATE"
|
||||
)
|
||||
|
||||
with db.ENGINE.begin() as conn:
|
||||
conn.execute(stmt)
|
||||
|
||||
# %%
|
||||
stmt = sql.text("ALTER TABLE grunderfassung_unternehmen RENAME TO grunderfassung")
|
||||
|
||||
with db.ENGINE.begin() as conn:
|
||||
conn.execute(stmt)
|
||||
# %%
|
||||
@@ -30,8 +30,8 @@ engine = sql.create_engine(f"sqlite:///{str(db_path)}")
|
||||
engine_crm = sql.create_engine(f"sqlite:///{str(crm_path)}")
|
||||
# %%
|
||||
stmt = sql.select(
|
||||
db.grunderfassung_unternehmen.c.erfassung_id,
|
||||
db.grunderfassung_unternehmen.c.Partnersuche__un_suche,
|
||||
db.grunderfassung.c.erfassung_id,
|
||||
db.grunderfassung.c.Partnersuche__un_suche,
|
||||
)
|
||||
|
||||
with engine.connect() as conn:
|
||||
@@ -44,7 +44,7 @@ for r in res:
|
||||
|
||||
|
||||
# %%
|
||||
backend.get_company_list()
|
||||
backend.front_get_company_list()
|
||||
|
||||
|
||||
# %%
|
||||
|
||||
Reference in New Issue
Block a user