From 07f17264500c388cb039eb33cdd89bc4f54d9505 Mon Sep 17 00:00:00 2001
From: Kapil Viren Ahuja <kvahuja@users.noreply.github.com>
Date: Thu, 16 Feb 2017 22:18:04 +0530
Subject: 1. using the right table names in SQL. 2. also put in some exception
 handling which spits out the error and moves on instead of exiting (#11)

* 1. using the right table names in SQL. 2. also put in some exception handling which spits out the error and moves on instead of exiting

* ID in participant table is  participant ID. we need a mapping for player ID in Web to get a player's matches.
---
 queries/match_participation.sql | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'queries/match_participation.sql')

diff --git a/queries/match_participation.sql b/queries/match_participation.sql
index 0fed84b..d37983f 100644
--- a/queries/match_participation.sql
+++ b/queries/match_participation.sql
@@ -1,6 +1,7 @@
 SELECT
 
-id AS "player_id",
+id AS "participant_id",
+relationships->'player'-> 'data' ->> 'id' AS player_id,
 0 AS "rosterId",
 0 AS "fk_player_id",
 0 AS "fk_match_results_id",
@@ -20,4 +21,4 @@ attributes->>'actor' AS "hero",
 (attributes->'stats'->>'wentAfk')::bool::int AS "wentAfk",
 FALSE AS "perfectGame"
 
-FROM apidata WHERE type='participant'
+FROM participant
-- 
cgit v1.3.1

