How to use the pydal.representers.for_type function in pydal

To help you get started, we’ve selected a few pydal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github web2py / pydal / pydal / representers / couchdb.py View on Github external
    @for_type("date", adapt=False)
    def _date(self, value):
        return serializers.json(value)
github web2py / pydal / pydal / representers / mssql.py View on Github external
    @for_type("geometry", adapt=False)
    def _geometry(self, value, srid):
        return "geometry::STGeomFromText('%s',%s)" % (value, srid)
github web2py / pydal / pydal / representers / base.py View on Github external
    @for_type("reference")
    def _reference(self, value):
        if isinstance(value, (Row, Reference)):
            value = value["id"]
        return long(value)
github web2py / pydal / pydal / representers / mongo.py View on Github external
    @for_type('datetime')
    def _datetime(self, value):
        return value
github web2py / pydal / pydal / representers / base.py View on Github external
    @for_type("decimal", adapt=False)
    def _decimal(self, value):
        return str(value)
github web2py / pydal / pydal / representers / base.py View on Github external
    @for_type("password")
    def _password(self, value):
        return to_unicode(value)
github web2py / pydal / pydal / representers / base.py View on Github external
    @for_type("bigint")
    def _bigint(self, value):
        return long(value)
github web2py / pydal / pydal / representers / google.py View on Github external
    @for_type("list:integer")
    def _list_integer(self, value):
        if not isinstance(value, list):
            return int(value)
        values = self._represent_list(value)
        return list(map(int, values))
github web2py / pydal / pydal / representers / mongo.py View on Github external
    @for_type('list:reference')
    def _list_reference(self, value):
        values = self._represent_list(value)
        return list(map(self.adapter.object_id, values))
github web2py / pydal / pydal / representers / base.py View on Github external
    @for_type("json")
    def _json(self, value):
        if isinstance(value, basestring):
            value = to_unicode(value)
            value = json.loads(value)
        return value

pydal

pyDAL is a Database Abstraction Layer. It generates queries for SQlite, PotsgreSQL, MySQL, and other backends. It was originally part of the web2py frameworks but it is now an independent project. Example: db.define_table("thing",Field("name")) and db.thing.insert(name="Pizza")

BSD-3-Clause
Latest version published 18 days ago

Package Health Score

81 / 100
Full package analysis