diff --git a/.idea/Pilgrim.iml b/.idea/Pilgrim.iml new file mode 100644 index 0000000..3defecc --- /dev/null +++ b/.idea/Pilgrim.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..daedced --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..3586794 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1748985568579 + + + + + + + + + + \ No newline at end of file diff --git a/src/Application/Application.py b/src/Application/Application.py new file mode 100644 index 0000000..cbdad0b --- /dev/null +++ b/src/Application/Application.py @@ -0,0 +1,11 @@ +from src.Database.Database import Database + + +class Application: + database = Database() + + def __init__(self): + pass + + def run(self): + self.database.create() diff --git a/src/Application/__init__.py b/src/Application/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/Database/Database.py b/src/Database/Database.py new file mode 100644 index 0000000..a9b08c4 --- /dev/null +++ b/src/Database/Database.py @@ -0,0 +1,19 @@ +from sqlalchemy import create_engine +from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import sessionmaker + +class Database: + def __init__(self): + self.engine = create_engine('sqlite:///database.db', echo=False,connect_args={"check_same_thread": False}) + self.Session = sessionmaker(bind=self.engine,autoflush=False,autocommit=False) + self.Base = declarative_base() + def create(self): + self.Base.metadata.create_all(self.engine) + def get_db(self): + db = self.Session() + try: + yield db + finally: + db.close() + + diff --git a/src/Database/__init__.py b/src/Database/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/Models/TravelDiary/TravelDiary.py b/src/Models/TravelDiary/TravelDiary.py new file mode 100644 index 0000000..3917bf1 --- /dev/null +++ b/src/Models/TravelDiary/TravelDiary.py @@ -0,0 +1,8 @@ +from sqlalchemy import Column, String, Integer + +from src.Application.Application import Application + +class TravelDiary(Application.database.Base): + __tablename__ = "TravelDiary" + id = Column(Integer, primary_key=True) + name = Column(String) diff --git a/src/Models/TravelDiary/__init__.py b/src/Models/TravelDiary/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/Models/__init__.py b/src/Models/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/main.py b/src/main.py new file mode 100644 index 0000000..43d5d75 --- /dev/null +++ b/src/main.py @@ -0,0 +1,6 @@ +from src.Application.Application import Application + + +if __name__ == '__main__': + App = Application() + App.run()