Conundrum

33 views
Skip to first unread message

John Currey

unread,
Feb 12, 2022, 1:48:58 PM2/12/22
to SDQL API
My biggest data mistake that I've made more often than I care to admit, is updating a game with t:team and o:team backward. 

For example:
  • In the database, I have a game with t:team as the Bruins, and o:team as the Canadiens. All my other data is good.  
  • I attempt to update the line in that game, and I inadvertently set t:team=Canadiens and o:team=Bruins for the same date. 
Instead of updating the line for t:team=Bruins and o:team=Canadiens and date=20220112, I add a new record to the database as: 
  • t:team=Canadiens and o:team=Bruins and date=20220112. 
The line is populated, and all other fields are None. 

I end up with a mess. 

Trying to clean it up, regardless if I use t:team=Bruins or o:team=Bruins and the associated other two keys, the database returns the record will all the data first, and the record with all the Nones second. 

Of course, I made a big mess and have a lot of these. I'd like to surgically remove the records with Nones, and leave the valid records. My remedy is to delete everything and re-add it correctly, but that takes a lot of time. I'm hoping there's some special index or key I can use to solve my problem and remove the record I want to delete. 

I'd also love a way to enhance my code to check to be sure I have t:team and o:team set correctly when attempting to update a specific game and avoid creating a new record if I get it backward, but using the Get request doesn't care which team I assign to t:team and o:team.

Joe Meyer

unread,
Feb 14, 2022, 9:25:12 AM2/14/22
to sdq...@googlegroups.com
Hi John,

I do not see the issue with your double entry of games,

Can you please send a link showing the problem?

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/92778920-5bf6-4ff0-a638-2bca796037e0n%40googlegroups.com.

John Currey

unread,
Feb 16, 2022, 6:36:59 PM2/16/22
to SDQL API
OK, on 7/23/2020 the Nat's hosted the Yankees. My database has all the values for the game. 

Joe Meyer

unread,
Feb 17, 2022, 11:04:28 AM2/17/22
to sdq...@googlegroups.com
John and API Friends,

I think the most flexible solution here is for you to write a Python script that:
  1) uses the get API to locate offending games. In this case: date,te...@jcurrey.site is None
  2) iterate through the results with the post API to remove each offending game

Also, my top API programmer informs me that you can use a wildcard for t:team to remove all games for a date.

data: { "date": 20200723,
           "t:team": "*"}

Best regards,

Joe Meyer
Sports Database LLC

John Currey

unread,
Feb 18, 2022, 6:34:16 PM2/18/22
to SDQL API
OK, I made an incorrect assumption early on, and that belief caused me to waste a lot of time needlessly. While I now see this is ridiculously easy, thank you for helping me over the hump!

Joe Meyer

unread,
Feb 18, 2022, 7:03:04 PM2/18/22
to sdq...@googlegroups.com
John and API Friends,
 
Don't forget the SDQL API is simple and, as K Popper teaches, we move forward by assumption and realization.
Reply all
Reply to author
Forward
0 new messages