Skip to content

Commit

Permalink
Merge pull request #54 from crcornwell/master
Browse files Browse the repository at this point in the history
Use Merge to Prevent Duplicated Data
  • Loading branch information
heavenshell authored May 8, 2019
2 parents e461379 + f2c7771 commit f41a705
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sqlalchemy_seed/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ def load_fixtures(session, fixtures):
instances.append(instance)

try:
session.add_all(instances)
for instance in instances:
session.merge(instance)
session.flush()
session.commit()
except Exception:
Expand Down

0 comments on commit f41a705

Please sign in to comment.