jowilf / sqlalchemy-file

SQLAlchemy-file is a SQLAlchemy extension for attaching files to SQLAlchemy model and uploading them to various storage such as Local Storage, Amazon S3, Rackspace CloudFiles, Google Storage and others using Apache Libcloud.
https://jowilf.github.io/sqlalchemy-file/
MIT License
91 stars 12 forks source link

Option to upload file by path #54

Closed adscib closed 10 months ago

adscib commented 1 year ago

Currently, the library only supports uploading files by stream. Would it be possible to add an option to upload by file path? That's supported in libcloud, so I suppose it wouldn't be too difficult. I'm happy to make a PR.

jowilf commented 1 year ago

Can you explain me the necessity of this function? File doesn't support file path

adscib commented 1 year ago

I'm storing large files that can't be fully loaded in memory and it saves me the headache of managing stream life cycles. I'm not sure whether it impacts performance. The other advantage is that File holds a local path to the underlying file even before it's committed.

I was able to get this to work in my fork by adding an extra argument to File.

jowilf commented 1 year ago

Hi @adscib, Would you be interested in submitting a PR?

adscib commented 1 year ago

For sure. See #87.