def countryLinkdataQuery(ID): results = sql_select("name AS label", TABLE_COUNTRIES, "id=" + str(ID))[0] results.update({ "url": "tipsymix.com/api/countries/" + str(stdLookup(ID, TABLE_COUNTRIES)), "id": ID }) return results
def brandLinkdataQuery(ID): results = sql_select("name AS label", TABLE_BRANDS, "id=" + str(ID))[0] results.update({ "url": "tipsymix.com/api/brands/" + str(stdLookup(ID, TABLE_BRANDS)), "id": ID }) return results
def cocktailLinkdataQuery(ID): results = sql_select("name AS label", TABLE_COCKTAILS, "id=" + str(ID))[0] results.update({ "url": "tipsymix.com/api/cocktails/" + str(stdLookup(ID, TABLE_COCKTAILS)), "id": ID }) return results
def ingredientLinkdataQuery(ID): results = sql_select("name AS label", TABLE_INGREDIENTS, "id=" + str(ID))[0] results.update({ "url": "tipsymix.com/api/ingredients/" + str(stdLookup(ID, TABLE_INGREDIENTS)), "id": ID }) return results
def tagsInIngredientQuery(ID): return [ match.get("tagID") for match in sql_select( "tagID", TABLE_TAGS_INGREDIENT, "ingredientID = " + str(ID)) ]
def tagsInBrandQuery(ID): return [ match.get("tagID") for match in sql_select("tagID", TABLE_TAGS_BRAND, "brandID = " + str(ID)) ]
def tagsInCocktailQuery(ID): return [ match.get("tagID") for match in sql_select("tagID", TABLE_TAGS_COCKTAIL, "cocktailID = " + str(ID)) ]
def brandsInCountryQuery(ID): return [ match.get("brandID") for match in sql_select( "brandID", TABLE_BRAND_COUNTRY, "countryID = " + str(ID)) ]
def stdLookup(slug, type): a = sql_select("stdname", type, "id=" + str(slug)) return a[0].get("stdname")
def fetchBrand(ID): return sql_select("*", TABLE_BRANDS, "id = " + str(ID))[0]
def fetchCocktail(ID): return sql_select("*", TABLE_COCKTAILS, "id = " + str(ID))[0]
def cocktailsInBrandQuery(ID): return [ match.get("cocktailID") for match in sql_select( "cocktailID", TABLE_COCKTAIL_BRAND, "brandID = " + str(ID)) ]
def ingredientsInBrandQuery(ID): return [ match.get("ingredientID") for match in sql_select( "ingredientID", TABLE_INGREDIENT_BRAND, "brandID = " + str(ID)) ]
def cocktailsInIngredientQuery(ID): return [ match.get("cocktailID") for match in sql_select("cocktailID", TABLE_COCKTAIL_INGREDIENT, "ingredientID = " + str(ID)) ]
def tagsInCountryQuery(ID): return [ match.get("tagID") for match in sql_select("tagID", TABLE_TAGS_COUNTRY, "countryID = " + str(ID)) ]
def countriesInBrandQuery(ID): return [ match.get("countryID") for match in sql_select( "countryID", TABLE_BRAND_COUNTRY, "brandID = " + str(ID)) ]
def tagQuery(ID): return sql_select("label", TABLE_TAGS, "id = " + str(ID))[0].get("label")
def ingredientsInCountryQuery(ID): return [ match.get("ingredientID") for match in sql_select( "ingredientID", TABLE_INGREDIENT_COUNTRY, "countryID = " + str(ID)) ]
def fetchIngredient(ID): return sql_select("*", TABLE_INGREDIENTS, "id = " + str(ID))[0]
def cocktailsInCountryQuery(ID): return [ match.get("cocktailID") for match in sql_select( "cocktailID", TABLE_COCKTAIL_COUNTRY, "countryID = " + str(ID)) ]
def fetchCountry(ID): return sql_select("*", TABLE_COUNTRIES, "id = " + str(ID))[0]
def idLookup(slug, type): a = sql_select("id", type, "stdname=" + str(slug)) return int(a[0].get("id"))