Skip to content

Commit

Permalink
Release 0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jowilf committed Oct 7, 2023
1 parent 13f4f58 commit 5ae55ce
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
9 changes: 9 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.6.0] - 2023-10-07

---

### Added

* Add option to upload files by path in [#87](https://github.com/jowilf/sqlalchemy-file/pull/87)
by [@adscib](https://github.com/adscib)

## [0.5.0] - 2023-07-21

---
Expand Down
11 changes: 11 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,22 @@ engine = create_engine(
Base.metadata.create_all(engine)

with Session(engine) as session, open("./example.txt", "rb") as local_file:
# from an opened local file
session.add(Attachment(name="attachment1", content=local_file))

# from bytes
session.add(Attachment(name="attachment2", content=b"Hello world"))

# from string
session.add(Attachment(name="attachment3", content="Hello world"))

# from a File object with custom filename and content_type
file = File(content="Hello World", filename="hello.txt", content_type="text/plain")
session.add(Attachment(name="attachment4", content=file))

# from a File object specifying a content path
session.add(Attachment(name="attachment5", content=File(content_path="./example.txt")))

session.commit()

```
Expand Down
13 changes: 13 additions & 0 deletions docs_src/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,22 @@ class Attachment(Base):
Base.metadata.create_all(engine)

with Session(engine) as session, open("./example.txt", "rb") as local_file:
# from an opened local file
session.add(Attachment(name="attachment1", content=local_file))

# from bytes
session.add(Attachment(name="attachment2", content=b"Hello world"))

# from string
session.add(Attachment(name="attachment3", content="Hello world"))

# from a File object with custom filename and content_type
file = File(content="Hello World", filename="hello.txt", content_type="text/plain")
session.add(Attachment(name="attachment4", content=file))

# from a File object specifying a content path
session.add(
Attachment(name="attachment5", content=File(content_path="./example.txt"))
)

session.commit()
2 changes: 1 addition & 1 deletion sqlalchemy_file/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.5.0"
__version__ = "0.6.0"

from .file import File as File # noqa
from .types import FileField as FileField # noqa
Expand Down

0 comments on commit 5ae55ce

Please sign in to comment.