Python Forum
How to check if the data is empty in a database?
Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to check if the data is empty in a database?
#5
(Aug-19-2017, 05:09 PM)ichabod801 Wrote: The error is in the first line. Since you changed program_id = ? to program_id is NULL, you don't need program_id in the second argument. That is, you took out where you were placing the thing (the ?), but you didn't take out what you were placing (program_id).

You have got it wrong there, I need to use program_id as a second argument because I am getting the value from the button object in each time when I get the value so I need to use it.

By the way, I try to use this:
cur.execute('SELECT program_id FROM programs WHERE program_id is NULL and channel=?;', (channel,))

if data is None:
   print "Now you are working on it........................."
else:
   print "You won't do anything........................"
It did not look up for the NULL data above of the value in a database in the same row as the channel when I am trying to use the channel variable to find the channel name in the same rows as the value.

If you are not sure what I am trying to do, please see the screenshots:

http://i.imgur.com/nwJGog8.png

http://i.imgur.com/hoe62gt.png

I want to find the value 3001, then look up of the null data in the same rows as the channel BBC ONE before I would do something. If there is no null data above of the value 3021 in the same rows as the channel ITV then I won't do something. I hope you get my point?
Reply


Messages In This Thread
RE: How to check if the data is empty in a database? - by chris0147 - Aug-19-2017, 05:49 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with to check an Input list data with a data read from an external source sacharyya 3 445 Mar-09-2024, 12:33 PM
Last Post: Pedroski55
  how do you style data frame that has empty rows. gsaray101 0 544 Sep-08-2023, 05:20 PM
Last Post: gsaray101
  How to detect abnormal data in big database python vanphuht91 5 1,169 Jun-27-2023, 11:22 PM
Last Post: Skaperen
  Database that can compress a column, or all data, automatically? Calab 3 1,232 May-22-2023, 03:25 AM
Last Post: Calab
  [SOLVED] [sqilte3] Check if column not empty? Winfried 5 1,151 Jan-28-2023, 12:53 PM
Last Post: Winfried
  Basic SQL query using Py: Inserting or querying sqlite3 database not returning data marlonbown 3 1,413 Nov-08-2022, 07:16 PM
Last Post: marlonbown
  Showing an empty chart, then input data via function kgall89 0 993 Jun-02-2022, 01:53 AM
Last Post: kgall89
  I need help parsing through data and creating a database using beautiful soup username369 1 1,727 Sep-22-2021, 08:45 PM
Last Post: Larz60+
  SaltStack: MySQL returner save less data into Database table columns xtc14 2 2,199 Jul-02-2021, 02:19 PM
Last Post: xtc14
  Looping to read data in database CEC68 1 1,739 Sep-24-2020, 08:54 PM
Last Post: scidam

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020