Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Duplicate keys

31 views
Skip to first unread message

John Currey

unread,
Jul 15, 2022, 9:19:49 AM7/15/22
to SDQL API
Hi, 

I noticed that in 2004, I have 3 games on the same day for several teams vs. their opponent. In investigating, I see that double header=2 has 2 records in the database for the same date, t:team and o:team. I'm wondering how the database would allow a duplicate key. I suspect a space or other invisible character is in there somewhere. This shows that the string fields match in length.


Thanks.


Joe Meyer

unread,
Jul 15, 2022, 9:37:39 AM7/15/22
to sdq...@googlegroups.com
John and SDQL API Friends,

I see that there is a data file saved for date=20040429 team=Red Sox double header=0.
My best guess is that you first saved this game with DH=0 and then updated to DH=2.
The problem is that the file is still here (along with the ones for DH=1 and DH=2).

To fix issue, just use the API to remove the game for: date=20040429 team=Red Sox double header=0

Best regards,

Joe  Meyer
Sports Database LLC

--

---
You received this message because you are subscribed to the Google Groups "SDQL API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sdqlapi+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sdqlapi/5ca6e83a-4c25-4417-ada1-8779bfb45774n%40googlegroups.com.

John Currey

unread,
Jul 15, 2022, 5:24:07 PM7/15/22
to SDQL API
Joe, 

So I'm confused by the terminology. I'm unsure what you mean by "data file". I think you're referring to a record in the database, but want to be sure. 

I don't see anything where date=20040429, team=Red Sox, double header=0. I see this, which has two games with the same date, t:team, o:team and both show double header=2. To me, that's a duplicate record. What am I missing?

Jul15.PNG

Joe Meyer

unread,
Jul 16, 2022, 5:08:32 PM7/16/22
to sdq...@googlegroups.com
John and SDQL API Friends,

when you upload a game to the server, it is saved in a datafile named by that game's key.
For MLB the key is: date, home team, double header.

For GimmeTheDog is see these three datafiles: 
20040429_Red Sox_0
20040429_Red Sox_1
20040429_Red Sox_2

To fix this issue, use the API to remove the game for: date=20040429 team=Red Sox double header=0 

Best regards,

Joe  Meyer
Sports Database LLC
 

John Currey

unread,
Jul 17, 2022, 1:39:08 PM7/17/22
to SDQL API
OK, I don't fully understand it. I am confused as to why the UI showed 2 games with double header=2. Nonetheless, I followed your instructions and it's fixed. Thanks, Joe!

John Currey

unread,
Jul 18, 2022, 6:19:52 PM7/18/22
to SDQL API
Here's another example of a duplicate key. There are 2 games with identical date,t:team, and o:team values. I'm not sure what I'm doing to cause this. In my brain, the database should not write a new record when a matching key exists. 

I can remove one of the games. If the answer is to simply remove the unwanted game, I accept that. I'm reporting it in case this is a real issue. 


Thanks. 

Joe Meyer

unread,
Jul 18, 2022, 6:56:46 PM7/18/22
to sdq...@googlegroups.com
John,

I see you have two data files for that game:
20210904_SJST
20210904_USC

I think this SDQL will help you figure out the problem and solution:
team,o:team,site@date=20210904 and team='USC'

Best regard,

Joe Meyer
Sports Database LLC
Reply all
Reply to author
Forward
0 new messages