Skip to content

Commit

Permalink
connection creates session
Browse files Browse the repository at this point in the history
  • Loading branch information
for-hyde committed Sep 26, 2024
1 parent df3c1e9 commit e193c94
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions omnipath_metabo/schema/_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,7 @@ def _uri(self) -> str:

def connect(self):
self.engine = create_engine(self._uri)
Session = sessionmaker(bind=self.engine)
self.session = Session()


6 changes: 3 additions & 3 deletions omnipath_metabo/schema/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ def create(self) -> None:

def load(self, resource) -> None:

loader = Loader(resource, self.con.engine)
loader = Loader(resource, self.session)
loader.load()


class Loader():
#accept scheme and resource.
def __init__(self, scheme, resource, session):
self.scheme = scheme
def __init__(self, resource, session):
self.scheme = resource.scheme
self.resource = resource
self.session = session

Expand Down
5 changes: 5 additions & 0 deletions omnipath_metabo/schema/_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ class Structure(Base):
id = Column(Integer, primary_key=True)
name = Column(String)
structure = Column('mol_structure', String)


class Hmdb(Base):
scheme = Structure

0 comments on commit e193c94

Please sign in to comment.