[Audio] Change database backend #3193

Closed
Drapersniper wants to merge 25 commits from apsw into V3/develop
Drapersniper commented 2019-12-17 21:08:57 +01:00 (Migrated from github.com)

Type

  • Bugfix
  • Enhancement
  • New feature

Description of the changes

Removed trhe Database dependency and change it over to apsw, + update SQL statements and make them a little bit better

### Type - [ ] Bugfix - [x] Enhancement - [ ] New feature ### Description of the changes Removed trhe Database dependency and change it over to apsw, + update SQL statements and make them a little bit better
Twentysix26 (Migrated from github.com) reviewed 2019-12-17 21:08:57 +01:00
mikeshardmind (Migrated from github.com) requested changes 2019-12-18 10:04:49 +01:00
mikeshardmind (Migrated from github.com) left a comment

This isn't a full review, just some things which I noticed at a relatively brief glance.

This isn't a full review, just some things which I noticed at a relatively brief glance.
@ -158,0 +37,4 @@
def _pass_config_to_apis(config: Config, bot: Red):
global _database, _config, _bot
if _config is None:
mikeshardmind (Migrated from github.com) commented 2019-12-18 09:43:38 +01:00

last_updated and last_fetched should be INTEGER types.

This may require altering existing tables if we are supporting people running dev changes.

last_updated and last_fetched should be INTEGER types. This may require altering existing tables if we are supporting people running dev changes.
mikeshardmind (Migrated from github.com) commented 2019-12-18 09:45:44 +01:00

use

DO UPDATE SET track_info=excluded.track_info, last_updated=excluded.last_updated

While the query optimizer should handle this, I'd prefer to not run into any edge cases where it doesn't.

use ``` DO UPDATE SET track_info=excluded.track_info, last_updated=excluded.last_updated ``` While the query optimizer *should* handle this, I'd prefer to not run into any edge cases where it doesn't.
mikeshardmind (Migrated from github.com) commented 2019-12-18 10:01:11 +01:00

After last_fetched is an INTEGER type,

SELECT data from lavalink
WHERE last_fetched > :match_after_timestamp
After last_fetched is an INTEGER type, ``` SELECT data from lavalink WHERE last_fetched > :match_after_timestamp ```
mikeshardmind (Migrated from github.com) requested changes 2019-12-20 08:13:46 +01:00
mikeshardmind (Migrated from github.com) commented 2019-12-20 08:12:13 +01:00

use redbot.core.data_manager.cog_data_path(None, raw_name="Audio") / "cache.db" here.

use `redbot.core.data_manager.cog_data_path(None, raw_name="Audio") / "cache.db"` here.
Drapersniper commented 2019-12-20 13:28:28 +01:00 (Migrated from github.com)

Do we want the cache tables AND Playlist table to be in the same Database?
This PR uses "cache.db" but #3195 uses "Audio.db"... I'm all for making the cache tables into "Audio.db". WDYT @mikeshardmind. If the answer is yes should i reuse the connection/cursor or should i keep them separate

Do we want the cache tables AND Playlist table to be in the same Database? This PR uses "cache.db" but #3195 uses "Audio.db"... I'm all for making the cache tables into "Audio.db". WDYT @mikeshardmind. If the answer is yes should i reuse the connection/cursor or should i keep them separate
mikeshardmind commented 2019-12-20 13:31:08 +01:00 (Migrated from github.com)

Same DB, singular connection. Multiple cursors is fine.

Same DB, singular connection. Multiple cursors is fine.
Drapersniper commented 2019-12-21 20:08:55 +01:00 (Migrated from github.com)

Do not merge this one ... Merge #3205

Do not merge this one ... Merge #3205
Drapersniper commented 2019-12-22 16:40:58 +01:00 (Migrated from github.com)

Will setup a CPR for all of this so itsd easier to follow ... less likely to fuck up)

Will setup a CPR for all of this so itsd easier to follow ... less likely to fuck up)

Pull request closed

Sign in to join this conversation.
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot!3193
No description provided.