views:

116

answers:

2

I'm trying to seamlessly integrate some legacy data into a django application. I would like to know if it's possible to use an alternate datasource for a django model. For example, can I contact a server to populate a list of a model? The server would not be SQL based at all. Instead it uses some proprietary tcp based protocol.

Copying the data is not an option, as the legacy application will continue to be used for some time. Would a custom manager allow me to do this?

This model should behave just like any other django model. It should even pluggable to the admin interface.

What do you think?

Thanks, Pete

A: 

This is not possible in current Django, short of reimplementing the entire Django ORM API on top of your custom data retrieval code.

There has been quite a bit of talk among Django developers about separating the ORM API (QuerySet, basically) from the SQL-specific Query backend in order to make it possible to write pluggable backends for non-relational data stores. It seems clear that this is the direction things are headed in, but there is no timeline for when it will be doable; even then you'd likely be in for quite a lot of work writing that pluggable backend for your system.

Carl Meyer
A: 

So basically this is a two tier problem:

1-MultiDB support >> Search for Mike Malone & MultiDB @ GITHUB

2-Non sql backend support >>NonSqlBackends

Roberto Rosario
Can you elaborate more?
instanceofTom
First you would need to write a Database Backend Driver for your data source to handle your "proprietary tcp based protocol". After that you need the write a custom Manager to allow your models to connect to your particular database source on a per model basis.http://www.eflorenzano.com/blog/post/easy-multi-database-support-django/Theres also a site called djangrrl -dot- com that has another example.There are a few examples but I can only post one link since I'm new here.
Roberto Rosario