'I want code of table in mysql without "Show columns" and "show create table" [closed]
I have a project where I must retrieve the data from a table, for example the column name, the size, if it is null or not, the problem is that I cannot use the following methods, and everything must be in a query, Can't use the console, does anyone know a solution?
I can't use this:
SHOW COLUMNS IN world.city; SHOW CREATE TABLE world.city;
Solution 1:[1]
In python :
#define `db` engine
com_schema ="SELECT COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_DEFAULT FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name =
'tbl_name';"
with db.connect() as conn:
status = conn.execute(com_schema).fetchall()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Marya |
