J. Nick Koston
a8aa0e1cca
Add Estimated Database Size to the recorder system health ( #71463 )
2022-05-07 21:02:54 -07:00
J. Nick Koston
eb77f8db85
Complete strict typing for recorder ( #71274 )
...
* Complete strict typing for recorder
* update tests
* Update tests/components/recorder/test_migrate.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update tests/components/recorder/test_migrate.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Remove the asserts
* remove ignore comments
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-05-04 12:22:50 -05:00
J. Nick Koston
5db014666c
Avoid recording state_changed events in the events table ( #71165 )
...
* squash
fix mypy
* Update homeassistant/components/recorder/models.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* pass all columns
* fix commented out code
* reduce logbook query complexity
* merge
* comment
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2022-05-02 02:10:34 -05:00
J. Nick Koston
c23866e5e5
De-duplicate event data into a new event_data table ( #71135 )
2022-05-01 21:01:17 -05:00
J. Nick Koston
6ce768465f
Improve purge performance for non-sqlite databases ( #70576 )
2022-04-26 13:11:57 -07:00
Dmitry Katsubo
521579fc6a
Fixed syntax error in ALTER TABLE statement ( #70304 ) ( #70336 )
2022-04-22 21:29:25 -10:00
Erik Montnemery
eb3458a3d2
Add MutexPool for recorder tests ( #69410 )
...
* Add MutexPool for recorder tests
* Fix get_schema_version
* Update test test_last_run_was_recently_clean
* Update test test_shutdown_before_startup_finishes
* Revert comments in test_write_lock_db
* Make the MutexPool lock a class variable
* Remove stale comment
* Move MutexPool
* Tweak debug prints
2022-04-12 07:41:46 -10:00
J. Nick Koston
d75f577b88
Additional strict typing for recorder ( #68860 )
2022-03-30 09:20:44 -07:00
J. Nick Koston
3c10ac308d
Fix migration to schema v25 with Postgresql ( #68426 )
2022-03-20 21:49:11 +01:00
J. Nick Koston
9215702388
Separate attrs into another table (reduces database size) ( #68224 )
2022-03-18 00:23:13 -10:00
Erik Montnemery
39ed628cca
Suppress unwanted error messages during recorder migration ( #66004 )
2022-02-07 15:46:40 -08:00
Erik Montnemery
1f8e8926fe
Only remove duplicated statistics on error ( #65653 )
2022-02-04 11:31:12 -08:00
Erik Montnemery
020953e943
Improve recorder migration for PostgreSQL when columns already exist ( #65680 )
2022-02-04 10:55:28 -08:00
Erik Montnemery
41ab12cb88
Don't use shared session during recorder migration ( #65672 )
2022-02-04 09:55:11 -08:00
Erik Montnemery
bceeaec2f8
Remove duplicated statistics rows ( #61146 )
...
* Remove duplicated statistics
* Fix misleading docstring
* Pylint knows best
* Correct test
* Oops
* Prevent insertion of duplicated statistics
* Tweak
* pylint
* Add models_schema_23.py
* Tweak
2021-12-13 14:15:36 +01:00
Erik Montnemery
d980ca7e04
Correct recorder migration._add_columns for PostgreSQL ( #60547 )
2021-11-29 18:33:25 +01:00
Erik Montnemery
2f3dea30e2
Correct migration to recorder schema 22 ( #59048 )
2021-11-04 10:29:10 +01:00
Erik Montnemery
f594bc353b
Add support for external statistics ( #56607 )
...
* Support external statistics
* Update tests
* Lint
* Adjust code after rebase
* Separate external statistic_id with :, add name to metadata
* Adjust tests
* Simplify get_metadata_with_session
* Address review comments
* Allow updating external statistics
* Validate input
* Adjust tests after rebase
* Pylint
* Adjust tests
* Improve test coverage
2021-10-26 10:26:50 +02:00
Erik Montnemery
e3534eec87
Report orphaned statistics in statistic validation ( #57324 )
2021-10-20 15:57:22 +02:00
Erik Montnemery
8337baa354
Correct migration to recorder schema 18 ( #57165 )
2021-10-06 13:29:42 +02:00
Erik Montnemery
dfb3a0c528
Correct database migration to schema version 22 ( #56848 )
2021-09-30 14:11:00 -07:00
Erik Montnemery
6af1a835e6
Optimize statistics generation ( #56821 )
...
* Optimize statistics generation
* pylint
2021-09-30 17:14:36 +02:00
Erik Montnemery
40ecf22bac
Remove automatic splitting of net meters from statistics ( #56772 )
2021-09-29 17:20:17 +02:00
Erik Montnemery
52e9f76f94
Tweak DB migration to schema version 21 ( #56767 )
2021-09-29 11:25:50 +02:00
Erik Montnemery
fe66d6295c
Improve migration to recorder schema version 21 ( #56204 )
2021-09-27 19:31:40 +02:00
Erik Montnemery
64393b462d
Add migration for 5-minute statistics ( #56585 )
...
* Add migration for 5-minute statistics
* Tweaks
2021-09-24 09:19:22 +02:00
Marcin Ciupak
b9ffd74db5
Fix recorder Oracle DB models ( #55564 )
...
* Fix recorder models for Oracle DB
* Fix StatisticsRuns
* Update migration for Oracle Identity columns.
* Update migration logic
Migration to schema version 22 done only for engine dialect oracle
* Add missing table check in schema 22 migration
2021-09-21 00:38:42 +02:00
Erik Montnemery
8c5efafdd8
Add 5-minute statistics for sensors ( #56006 )
...
* Add 5-minute statistics for sensors
* Address pylint issues
* Black
* Apply suggestion from code review
* Apply suggestions from code review
* Improve tests
2021-09-16 10:57:15 +02:00
Erik Montnemery
88dbc6373f
Make sure character set of events, states tables is utf8 ( #56012 )
...
* Make sure character set of events, states tables is utf8
* Pylint
* Apply suggestions from code review
2021-09-09 19:26:28 +02:00
Erik Montnemery
a47532c69b
Change character set of statistics_meta table to utf8 ( #56011 )
2021-09-09 17:24:20 +02:00
Erik Montnemery
80fd330479
Add sum_decrease and sum_increase statistics ( #55850 )
2021-09-08 23:35:53 -07:00
Erik Montnemery
0624859bf4
Set statistics columns to double precision ( #55053 )
2021-08-24 11:18:59 +02:00
Erik Montnemery
32e297f4a0
Compile missing statistics ( #54690 )
2021-08-19 22:10:45 -07:00
Ville Skyttä
470f2dd73f
Upgrade pyupgrade to 2.21.2, apply its changes ( #52987 )
2021-07-19 10:46:09 +02:00
Franck Nijhof
74029a0948
Fix Statistics recorder migration path by dropping in pairs ( #52453 )
2021-07-05 13:34:40 +02:00
Franck Nijhof
5e9127ef7a
Remove problematic/redudant db migration happning schema 15 ( #52541 )
2021-07-05 13:28:01 +02:00
Franck Nijhof
7f3f6757ea
Fix Statistics recorder migration order ( #52449 )
2021-07-02 20:55:40 +02:00
Erik Montnemery
24ae05b734
Drop statistic_id and source columns from statistics table ( #52417 )
...
* Drop statistic_id and source columns from statistics table
* Remove useless double drop of statistics table
* Update homeassistant/components/recorder/models.py
Co-authored-by: Franck Nijhof <git@frenck.dev>
* black
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-07-02 13:17:00 +02:00
Erik Montnemery
0ab999738b
Add statistics meta data table ( #52331 )
...
* Add statistics meta data table
* Tweak meta data generation
2021-06-30 13:32:17 +02:00
J. Nick Koston
06c9a50869
Handle missing options in foreign_key for MSSQL ( #51503 )
2021-06-05 12:13:12 +02:00
Marcin Ciupak
caad125b44
Add support for Oracle DB in recorder ( #50090 )
2021-05-22 21:10:27 -05:00
Erik Montnemery
e16a8063a5
Compile statistics for energy sensors ( #50829 )
...
* Compile statistics for energy sensors
* Update tests
* Rename abs_value to state
* Tweak
* Recreate statistics table
* Pylint
* Try to fix test
* Fix statistics for multiple energy sensors
* Fix energy statistics when last_reset is not set
2021-05-20 13:05:15 +02:00
J. Nick Koston
1c8d9ca68b
Check exception causes for matching strings during recorder migration ( #49999 )
2021-05-02 20:57:42 -07:00
J. Nick Koston
c10836fcee
Upgrade to sqlalchemy 1.4.11 ( #49538 )
2021-04-21 20:29:36 -10:00
J. Nick Koston
9368891b1b
Live db migrations and recovery ( #49036 )
...
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-04-11 20:43:54 -10:00
Laszlo Magyar
c7e4857d2c
Let recorder deal with event names longer than 32 chars ( #47748 )
2021-04-08 07:08:49 -10:00
Stefan Agner
815db999da
Use microsecond precision for datetime values on MariaDB/MySQL ( #48749 )
...
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-04-07 09:13:55 +02:00
CurrentThread
7c8851264f
Use LONGTEXT column instead of TEXT for MySQL/MariaDB and migrate existing databases ( #47026 )
2021-03-10 08:12:58 -10:00
J. Nick Koston
dc26fd5149
Ensure creating an index that already exists is forgiving for postgresql ( #46185 )
...
Unlikely sqlite and mysql, postgresql throws ProgrammingError instead
of InternalError or OperationalError when trying to create an index
that already exists.
2021-02-08 23:22:38 +01:00
J. Nick Koston
12af87bc6e
Add index to old_state_id column for postgres and older databases ( #44757 )
...
* Add index to old_state_id column for older databases
The schema was updated in #43610 but the index was not
added on migration.
* Handle postgresql missing ondelete
* create index first
2021-01-04 10:51:44 +01:00