Jump to content

Any thoughts on developing support for alternative database backends?


Sludge Vohaul

Recommended Posts

Sludge Vohaul

Hi,

 

though sqlite is sufficient, I think it would be a nice if users could choose between different database backends. 

 

Currently there is at least the DDL code embedded in the csharp sources. IMO this should be rewritten one day anyway. If there was a commitment to support multiple ®DBMS's, one would have to go through this code and probably develop some sort of abstraction vie DDL template files or similar. This would remove unnecessary database-code from the Emby-codebase, and also eliminate the need for new Emby-builds should anything change in the database schema.

And it certainly would lead to an interface layer between the application and the database, which would be based on database functions (stored procs), (materialized) views and similar. This layer would lead to a real independence on the used data-backend. 

 

In the end it would allow a new category of plugins/API calls -  the "data based stuff".

From the Plex point of view (I haven't got so far with Emby yet) imagine I had a movie collection called "Terminator", containing all Terminator-movies. One day I'd decide to change the collection's name. Currently (in Plex and I think in Emby, too) I would have to create a new collection e.g. "Terminator Rules", go through all the movies contained in the "Terminator" collection, assign them to the "Terminator Rules" collection, remove them from the "Terminator" collection and delete the "Terminator" collection afterwards (basically an UPDATE some_table SET collection_name='Terminator Rules' WHERE collection_name='Terminator').

The new API call would only have to hook up into the already existing data structure and internally call a database function, which would only have to be implemented for all supported databases.

 

As there is no magic voodoo regarding the database interaction in the Emby sources (correct me if I am wrong - I just quickly went through them), the abstraction should be quite straight forward.

 

As a bonus, one would get RDBMS's dump functionality for backups for free and eventually replication for fail overs. 

 

What do you think?

 

--sv

Link to comment
Share on other sites

Hi, it is a possibility for the future, yes. We do have an isolated data layer already though.

 

For the question about Collections, in Emby you can just rename the collection.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...