Exemplo n.º 1
0
asm.setid("animal", 100)
asm.setid("owner", 100)
asm.setid("adoption", 100)

print("\\set ON_ERROR_STOP\nBEGIN;")
print("DELETE FROM animal WHERE ID >= 100 AND CreatedBy LIKE '%conversion';")
print("DELETE FROM owner WHERE ID >= 100 AND CreatedBy = 'conversion';")
print("DELETE FROM adoption WHERE ID >= 100 AND CreatedBy = 'conversion';")

pf = ""
if PETFINDER_ID != "":
    asm.setid("media", 100)
    asm.setid("dbfs", 200)
    print("DELETE FROM media WHERE ID >= 100;")
    print("DELETE FROM dbfs WHERE ID >= 200;")
    pf = asm.petfinder_get_adoptable(PETFINDER_ID)

data = asm.csv_to_list(PATH)

uo = asm.Owner()
uo.OwnerSurname = "Unknown Owner"
uo.OwnerName = uo.OwnerSurname
owners.append(uo)

# petpal files are newest first order
for d in reversed(data):
    a = asm.Animal()
    animals.append(a)
    a.AnimalTypeID = asm.iif(d["Pet Type"] == "Cat", 11, 2)
    if a.AnimalTypeID == 11 and d["Intake Type"] == "Stray":
        a.AnimalTypeID = 12
Exemplo n.º 2
0
#!/usr/bin/python

import asm

"""
Import script for kc0748 access database (almost home rescue)
9th March March, 2015
"""

# --- START OF CONVERSION ---

# The shelter's petfinder ID for grabbing animal images for adoptable animals
PETFINDER_ID = "CO145"
pf = ""
if PETFINDER_ID != "":
    pf = asm.petfinder_get_adoptable(PETFINDER_ID)

owners = {}
movements = []
animals = {}
ownerdonations = []
animalvaccinations = []

asm.setid("animal", 100)
asm.setid("animalvaccination", 100)
asm.setid("owner", 100)
asm.setid("ownerdonation", 100)
asm.setid("adoption", 100)
asm.setid("media", 100)
asm.setid("dbfs", 300)