def validate_server_db1():
"""Server may have only single database of particular type"""
cursor = connection.cursor()
query = """
SELECT MAX(counted) FROM
(
SELECT COUNT(*) AS counted
FROM api_db
WHERE type = "S"
GROUP BY server_id,type_db
) AS counts;
"""
cursor.execute(query)
res = cursor.fetchone()[0]
if res > 1:
return [
'Server may have only single database of particular type!']
return []
评论列表
文章目录