Skip to content

Commit

Permalink
Fixed #225, fix DB-API wrapper for binary type
Browse files Browse the repository at this point in the history
  • Loading branch information
fantix committed May 18, 2018
1 parent a367e06 commit da60216
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gino/dialects/base.py
Expand Up @@ -13,6 +13,11 @@ class BaseDBAPI:
paramstyle = 'numeric'
Error = Exception

# noinspection PyPep8Naming
@staticmethod
def Binary(x):
return x


class DBAPICursor:
def execute(self, statement, parameters):
Expand Down
1 change: 1 addition & 0 deletions tests/models.py
Expand Up @@ -62,6 +62,7 @@ class Relation(db.Model):
__tablename__ = 'gino_relation'

name = db.Column(db.Text(), primary_key=True)
logo = db.Column(db.LargeBinary())


def qsize(engine):
Expand Down
9 changes: 9 additions & 0 deletions tests/test_dialect.py
@@ -0,0 +1,9 @@
import pytest
from .models import Relation

pytestmark = pytest.mark.asyncio


async def test_225_large_binary(bind):
c = await Relation.create(name='xx', logo=b'SVG LOGO')
assert c.logo == b'SVG LOGO'

0 comments on commit da60216

Please sign in to comment.