Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. br = 0
  2. def save_plants():
  3. for item in biljne_vrste:
  4. cursor.execute("SELECT id FROM plant WHERE name=%s", (biljne_vrste[br],))
  5. biljkanadjena = cursor.fetchone() #dohvata id za prosledjen name biljke
  6.  
  7. if biljkanadjena is not None:
  8. print ("ima ga")
  9.  
  10. else:
  11. print("biljke nema")
  12. query = "INSERT INTO plant (version, name, production_type, enabled, deleted) VALUES
  13. ({}, {}, {}, {}, {})" \
  14. .format(insecticide_dto["version"], biljne_vrste[br],
  15. insecticide_dto["production_type"],
  16. insecticide_dto["enabled"], insecticide_dto["deleted"])
  17. save_pln.execute(query)
  18. br+=1
  19. save_plants()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement