Skip to content

Commit

Permalink
tooling with new insertion methods
Browse files Browse the repository at this point in the history
  • Loading branch information
for-hyde committed Oct 30, 2024
1 parent 95de6cc commit bde961d
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions omnipath_metabo/schema/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ def load(self, resource) -> None:
loader = Loader(resource, self.con)
loader.load()

def test_load(self, resource) -> None:

loader = Loader(resource, self.con)
loader.new_load()

def substructure_search(self, substructure):

query = f"select name, mol from structures where mol @>'{substructure}'"
Expand Down Expand Up @@ -170,6 +175,13 @@ def create(self) -> None:

create(self.con)




def new_load(self, batch_size = 1000):

self.create()

#Creat method for populating using iterator.

self.session.scalars(
insert(_structure.Structure).on_conflict_do_nothing()
[x for x in self.resource]
)

0 comments on commit bde961d

Please sign in to comment.