P
P
pozner882021-10-20 16:32:09
SQL
pozner88, 2021-10-20 16:32:09

How to change the default value in the SQL database during the program?

Greetings gentlemen. Faced a small problem. When creating a table in SQL, one default value is specified, but the program needs to change it.
Tell me how you can do this in Python, the question seems to be not difficult, but somehow I did not find an answer by googling. Thanks to

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Ronald McDonald, 2021-10-20
@Zoominger

Use the module to work with a specific DBMS (pymysql, pysqlite) and change the values ​​in the table with SQL queries.

A
Akina, 2021-10-20
@Akina

The default value (unless it's an auto-generated value, such as an auto-increment or a current-time stamp) is an insurance policy that should not be used at all if programmed correctly.
Assign the desired value explicitly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question