Merge branch 'jmagnusson-printable-arrow-obj'

This commit is contained in:
Konsta Vesterinen
2016-01-20 13:19:19 +02:00
2 changed files with 11 additions and 0 deletions

View File

@@ -74,6 +74,9 @@ class ArrowType(types.TypeDecorator, ScalarCoercible):
return arrow.get(value)
return value
def process_literal_param(self, value, dialect):
return str(value)
def _coerce(self, value):
if value is None:
return None

View File

@@ -56,3 +56,11 @@ class TestArrowDateTimeType(object):
assert article.created_at == time == local
session.commit()
assert article.created_at == time
def test_literal_param(self, session, Article):
time = arrow.arrow.utcnow()
article = Article(created_at=time)
session.add(article)
clause = Article.created_at > '2015-01-01'
compiled = str(clause.compile(compile_kwargs={"literal_binds": True}))
assert compiled == 'article.created_at > 2015-01-01'