X
X
xxxfdd2020-12-12 00:03:44
Python
xxxfdd, 2020-12-12 00:03:44

How do I count how many total id in sql table through python language?

How do I count how many total id in sql table through python language?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Eremin, 2020-12-12
@Sergei_Erjemin

Unfortunately, it is not clear from the question how you work with the database from Python. Through the client, through cursors? Therefore, the question remains how you can drag the result of the query into the python from the database itself.
In general, you need to execute a database query like:

SELECT
  COUNT(table.id) AS num_id
FROM table
will num_idbe your answer.

D
Danya  , 2020-12-12
@MrBrainop

output to the id_list variable a list of all id
's and output their number

id_list = #Список ID(из БД прочитай)
print(len(id_list))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question