rrs/views: fix case in table names

Table names should be lowercase. I'm unsure if the collation settings
have an effect on this, but with the mariadb database I set up here I
needed to make this change or else I got errors about missing tables.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2018-03-20 16:35:43 +13:00
parent 24db787f68
commit 8517822d43

View File

@ -67,7 +67,7 @@ class Raw():
""" Get all Recipes """ """ Get all Recipes """
cur = connection.cursor() cur = connection.cursor()
cur.execute("""SELECT id, pn, pv, summary cur.execute("""SELECT id, pn, pv, summary
FROM layerindex_Recipe; FROM layerindex_recipe;
""") """)
return Raw.dictfetchall(cur) return Raw.dictfetchall(cur)
@ -78,7 +78,7 @@ class Raw():
cur = connection.cursor() cur = connection.cursor()
cur.execute("""SELECT DISTINCT rema.recipe_id cur.execute("""SELECT DISTINCT rema.recipe_id
FROM rrs_RecipeMaintainer AS rema FROM rrs_recipemaintainer AS rema
INNER JOIN rrs_maintainer AS ma INNER JOIN rrs_maintainer AS ma
ON rema.maintainer_id = ma.id ON rema.maintainer_id = ma.id
WHERE rema.history_id = %s WHERE rema.history_id = %s
@ -97,8 +97,8 @@ class Raw():
if date_id: if date_id:
qry = """SELECT rema.recipe_id, ma.name qry = """SELECT rema.recipe_id, ma.name
FROM rrs_RecipeMaintainer AS rema FROM rrs_recipemaintainer AS rema
INNER JOIN rrs_Maintainer AS ma INNER JOIN rrs_maintainer AS ma
ON rema.maintainer_id = ma.id""" ON rema.maintainer_id = ma.id"""
qry += "\nWHERE rema.history_id = '%s'" % str(date_id) qry += "\nWHERE rema.history_id = '%s'" % str(date_id)
qry += "\nAND rema.recipe_id IN (%s);" % recipes qry += "\nAND rema.recipe_id IN (%s);" % recipes
@ -124,7 +124,7 @@ class Raw():
if date_id: if date_id:
recipes = str(recipes).strip('[]') recipes = str(recipes).strip('[]')
qry = """SELECT id, status, no_update_reason qry = """SELECT id, status, no_update_reason
FROM rrs_RecipeUpstream""" FROM rrs_recipeupstream"""
qry += "\nWHERE history_id = '%s'" % str(date_id.id) qry += "\nWHERE history_id = '%s'" % str(date_id.id)
qry += "\nAND recipe_id IN (%s);" % recipes qry += "\nAND recipe_id IN (%s);" % recipes
cur = connection.cursor() cur = connection.cursor()
@ -151,7 +151,7 @@ class Raw():
if date_id: if date_id:
qry = """SELECT recipe_id, status, no_update_reason, version qry = """SELECT recipe_id, status, no_update_reason, version
FROM rrs_RecipeUpstream""" FROM rrs_recipeupstream"""
qry += "\nWHERE history_id = '%s'" % str(date_id) qry += "\nWHERE history_id = '%s'" % str(date_id)
qry += "\nAND recipe_id IN (%s);" % recipes qry += "\nAND recipe_id IN (%s);" % recipes
cur = connection.cursor() cur = connection.cursor()
@ -175,7 +175,7 @@ class Raw():
""" Get Recipes not up to date based on Recipe Upstream History """ """ Get Recipes not up to date based on Recipe Upstream History """
cur = connection.cursor() cur = connection.cursor()
cur.execute("""SELECT DISTINCT recipe_id cur.execute("""SELECT DISTINCT recipe_id
FROM rrs_RecipeUpstream FROM rrs_recipeupstream
WHERE status = 'N' WHERE status = 'N'
AND history_id = %s AND history_id = %s
""", [date_id]) """, [date_id])
@ -190,9 +190,9 @@ class Raw():
PARTITION BY recipe_id PARTITION BY recipe_id
ORDER BY commit_date DESC ORDER BY commit_date DESC
) AS rownum ) AS rownum
FROM rrs_RecipeUpgrade FROM rrs_recipeupgrade
WHERE commit_date <= %s) AS te WHERE commit_date <= %s) AS te
INNER JOIN layerindex_Recipe AS re INNER JOIN layerindex_recipe AS re
ON te.recipe_id = re.id ON te.recipe_id = re.id
WHERE rownum = 1 WHERE rownum = 1
ORDER BY re.pn; ORDER BY re.pn;
@ -204,7 +204,7 @@ class Raw():
""" Get Recipe Upgrade for the milestone """ """ Get Recipe Upgrade for the milestone """
cur = connection.cursor() cur = connection.cursor()
cur.execute("""SELECT id, recipe_id, maintainer_id, author_date, commit_date cur.execute("""SELECT id, recipe_id, maintainer_id, author_date, commit_date
FROM rrs_RecipeUpgrade FROM rrs_recipeupgrade
WHERE commit_date >= %s WHERE commit_date >= %s
AND commit_date <= %s AND commit_date <= %s
ORDER BY commit_date DESC; ORDER BY commit_date DESC;
@ -218,7 +218,7 @@ class Raw():
cur = connection.cursor() cur = connection.cursor()
qry = """SELECT DISTINCT recipe_id qry = """SELECT DISTINCT recipe_id
FROM rrs_RecipeUpgrade""" FROM rrs_recipeupgrade"""
qry += "\nWHERE commit_date >= '%s'" % str(start_date) qry += "\nWHERE commit_date >= '%s'" % str(start_date)
qry += "\nAND commit_date <= '%s'" % str(end_date) qry += "\nAND commit_date <= '%s'" % str(end_date)
qry += "\nAND recipe_id IN (%s);" % recipes qry += "\nAND recipe_id IN (%s);" % recipes
@ -231,7 +231,7 @@ class Raw():
cur = connection.cursor() cur = connection.cursor()
cur.execute("""SELECT id cur.execute("""SELECT id
FROM rrs_RecipeMaintainerHistory FROM rrs_recipemaintainerhistory
WHERE date <= %s WHERE date <= %s
ORDER BY date DESC ORDER BY date DESC
LIMIT 1; LIMIT 1;
@ -241,7 +241,7 @@ class Raw():
if not ret: if not ret:
cur.execute("""SELECT id cur.execute("""SELECT id
FROM rrs_RecipeMaintainerHistory FROM rrs_recipemaintainerhistory
ORDER BY date ORDER BY date
LIMIT 1; LIMIT 1;
""") """)