сохраненные данные, как их видит DBeaver:
(см. прикрепленный файл картинку)
или
Код: Выделить всё
1737210600 0.0911
1737209700 0.103
1737208800 0.1004
1737207900 0.0697
1737207000 0.0824
Код: Выделить всё
import mariadb
mariadb_host = "xxxxxx"
mariadb_db_verbruik = "powerdb"
conn_verbruik = mariadb.connect(
host=mariadb_host,
user='xxxxx',
password='xxxxx',
database=mariadb_db_verbruik
)
cursor_verbruik = conn_verbruik.cursor()
sql = f"SELECT time, gridE_tot, 1000*gridE_tot as test from periode15 ORDER BY time DESC LIMIT 5"
cursor_verbruik.execute(sql)
result_verbruik = cursor_verbruik.fetchall()
if (result_verbruik):
for line in result_verbruik:
print(line)
print(1000*line[1])
Код: Выделить всё
(1737210600, 0.0, 91.0)
0.0
(1737209700, 0.0, 103.0)
0.0
(1737208800, 0.0, 100.0)
0.0
(1737207900, 0.0, 69.0)
0.0
(1737207000, 0.0, 82.0)
0.0
Данные хранятся в виде двойника в mariaDB.
Изменить в ответ @Rick James
Код: Выделить всё
CREATE TABLE `periode15` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`time` bigint(20) NOT NULL,
`gridE_tot` double DEFAULT NULL,
`gridE_tot_neg` double DEFAULT NULL,
`solar1E_tot` double DEFAULT NULL,
`solar2E_tot` double DEFAULT NULL,
`gridE_tot_pos` double DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `time` (`time`)
) ENGINE=InnoDB AUTO_INCREMENT=387908 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
Подробнее здесь: https://stackoverflow.com/questions/793 ... unded-down
Мобильная версия