You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spot.apache.org by ev...@apache.org on 2017/03/29 16:51:37 UTC

[13/50] [abbrv] incubator-spot git commit: Adding proxy ingest summary method

Adding proxy ingest summary method


Project: http://git-wip-us.apache.org/repos/asf/incubator-spot/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-spot/commit/8f151f54
Tree: http://git-wip-us.apache.org/repos/asf/incubator-spot/tree/8f151f54
Diff: http://git-wip-us.apache.org/repos/asf/incubator-spot/diff/8f151f54

Branch: refs/heads/SPOT-35_graphql_api
Commit: 8f151f544a706707f0c9acc0b934235fd8ff38b7
Parents: 6c1f300
Author: Everardo Lopez Sandoval (Intel) <el...@elopezsa-mac02.zpn.intel.com>
Authored: Mon Mar 6 10:56:02 2017 -0600
Committer: Diego Ortiz Huerta <di...@intel.com>
Committed: Wed Mar 15 11:49:47 2017 -0700

----------------------------------------------------------------------
 spot-oa/api/resources/dns.py   |  8 +++-----
 spot-oa/api/resources/proxy.py | 18 ++++++++++++++++++
 2 files changed, 21 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-spot/blob/8f151f54/spot-oa/api/resources/dns.py
----------------------------------------------------------------------
diff --git a/spot-oa/api/resources/dns.py b/spot-oa/api/resources/dns.py
index ba26ae9..8924470 100644
--- a/spot-oa/api/resources/dns.py
+++ b/spot-oa/api/resources/dns.py
@@ -322,9 +322,7 @@ def  save_comments(ip,query,title,text,date):
 
     return True
 """
---------------------------------------------------------------------------
 Return a list(dict) with all the data ingested during the time frame provided.
---------------------------------------------------------------------------
 """
 def ingest_summary(start_date,end_date):
 
@@ -334,9 +332,9 @@ def ingest_summary(start_date,end_date):
                     tdate,total
                 FROM {0}.dns_ingest_summary
                 WHERE
-                    ( y <= {1} and y >= {2}) AND
-                    ( m <= {3} and m >= {4})
+                    ( y >= {1} and y <= {2}) AND
+                    ( m >= {3} and m <= {4})
                 """)\
-                .format(start_date.year,end_date.year,start_date.month,end_date.month)
+                .format(db,start_date.year,end_date.year,start_date.month,end_date.month)
 
     return ImpalaEngine.execute_query_as_list(is_query)

http://git-wip-us.apache.org/repos/asf/incubator-spot/blob/8f151f54/spot-oa/api/resources/proxy.py
----------------------------------------------------------------------
diff --git a/spot-oa/api/resources/proxy.py b/spot-oa/api/resources/proxy.py
index a2a8e46..6f86aae 100644
--- a/spot-oa/api/resources/proxy.py
+++ b/spot-oa/api/resources/proxy.py
@@ -381,3 +381,21 @@ def incident_progression(date,uri):
         .format(hdfs_path,file_name)))
     else:
         return {}
+
+"""
+Return a list(dict) with all the data ingested during the time frame provided.
+"""
+def ingest_summary(start_date,end_date):
+
+    db = Configuration.db()
+    is_query = ("""
+                SELECT
+                    tdate,total
+                FROM {0}.proxy_ingest_summary
+                WHERE
+                    ( y >= {1} and y <= {2}) AND
+                    ( m >= {3} and m <= {4})
+                """)\
+                .format(db,start_date.year,end_date.year,start_date.month,end_date.month)
+
+    return ImpalaEngine.execute_query_as_list(is_query)