[Django]-SQL Server Filestream with django-mssql

2👍

Just in case anyone else is interested in using SQL Server Filestream feature, and ends up here, I started working on custom django Fields to support Filestream : a FileStreamDataField that maps to the varbinary(max) FILESTREAM type and a FileStreamField which is a virtual field that wraps the win32 Streaming API.

import uuid

from django.db import models
from sql_filestream import FileStreamDataField, FileStreamField, UUIDField

class DocumentModel(models.Model):
    doc_id = UUIDField(default=uuid.uuid4)
    doc_content = FileStreamDataField(identifier_field='doc_id', null=True, blank=True)
    document = FileStreamField('doc_id', 'doc_content') 

You can find it with examples here : https://github.com/rparent/django-mssql-filestream
It works well my use case but is certainly incomplete.
Contributions welcome !

Leave a comment