42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
from sqlalchemy import create_engine
|
|
from sqlalchemy.orm import sessionmaker
|
|
import json
|
|
|
|
# Setup DB
|
|
DB_PATH = "sqlite:///companies_v3_fixed_2.db"
|
|
engine = create_engine(DB_PATH)
|
|
SessionLocal = sessionmaker(bind=engine)
|
|
session = SessionLocal()
|
|
|
|
from sqlalchemy import Column, Integer, String
|
|
from sqlalchemy.ext.declarative import declarative_base
|
|
|
|
Base = declarative_base()
|
|
|
|
class Company(Base):
|
|
__tablename__ = "companies"
|
|
id = Column(Integer, primary_key=True)
|
|
street = Column(String)
|
|
zip_code = Column(String)
|
|
|
|
def fix_benni():
|
|
company_id = 33
|
|
print(f"🔧 Fixing Address for Company ID {company_id}...")
|
|
|
|
company = session.query(Company).filter_by(id=company_id).first()
|
|
if not company:
|
|
print("❌ Company not found.")
|
|
return
|
|
|
|
# Hardcoded from previous check_benni.py output to be safe/fast
|
|
# "street": "Eriagstraße 58", "zip": "85053"
|
|
|
|
company.street = "Eriagstraße 58"
|
|
company.zip_code = "85053"
|
|
|
|
session.commit()
|
|
print(f"✅ Database updated: Street='{company.street}', Zip='{company.zip_code}'")
|
|
|
|
if __name__ == "__main__":
|
|
fix_benni()
|