When you import from another file, it runs the whole file. If there’s a part of the file you don’t want to be run, put it in an if __name__ == "__main__"
, like this:
if __name__ == "__main__":
engine = sql.create_engine('sqlite:///../docs/database.db', echo=True)
Base.metadata.create_all(engine)
CLICK HERE to find out more related problems solutions.