示例#1
0
# www.navitia.io

from __future__ import absolute_import
import uuid
import re
from navitiacommon.sqlalchemy import SQLAlchemy
from sqlalchemy.orm import backref
from datetime import datetime
from sqlalchemy import func, and_, UniqueConstraint, cast, true, false
from sqlalchemy.dialects.postgresql import ARRAY, UUID, INTERVAL
from sqlalchemy.dialects.postgresql.json import JSONB

from navitiacommon import default_values
import os

db = SQLAlchemy()  # type: SQLAlchemy


class TimestampMixin(object):
    created_at = db.Column(db.DateTime(),
                           default=datetime.utcnow,
                           nullable=False)
    updated_at = db.Column(db.DateTime(),
                           default=None,
                           onupdate=datetime.utcnow)


# https://bitbucket.org/zzzeek/sqlalchemy/issues/3467/array-of-enums-does-not-allow-assigning
class ArrayOfEnum(ARRAY):
    def bind_expression(self, bindvalue):
        return cast(bindvalue, self)
示例#2
0
# www.navitia.io

from __future__ import absolute_import
import uuid
import re
from navitiacommon.sqlalchemy import SQLAlchemy
from sqlalchemy.orm import backref
from datetime import datetime
from sqlalchemy import func, and_, UniqueConstraint, cast, true, false
from sqlalchemy.dialects.postgresql import ARRAY, UUID, INTERVAL
from sqlalchemy.dialects.postgresql.json import JSONB

from navitiacommon import default_values
import os

db = SQLAlchemy()  # type: SQLAlchemy


class TimestampMixin(object):
    created_at = db.Column(db.DateTime(),
                           default=datetime.utcnow,
                           nullable=False)
    updated_at = db.Column(db.DateTime(),
                           default=None,
                           onupdate=datetime.utcnow)


# https://bitbucket.org/zzzeek/sqlalchemy/issues/3467/array-of-enums-does-not-allow-assigning
class ArrayOfEnum(ARRAY):
    def bind_expression(self, bindvalue):
        return cast(bindvalue, self)
示例#3
0
import uuid
import re
from navitiacommon.sqlalchemy import SQLAlchemy
from geoalchemy2.types import Geography
from flask import current_app
from sqlalchemy.orm import load_only, backref, aliased
from datetime import datetime
from sqlalchemy import func, and_, UniqueConstraint, cast, true, false
from sqlalchemy.dialects.postgresql import ARRAY, UUID, INTERVAL
from sqlalchemy.dialects.postgresql.json import JSONB
from navitiacommon.utils import street_source_types, address_source_types, poi_source_types, admin_source_types

from navitiacommon import default_values
import os

db = SQLAlchemy()


class TimestampMixin(object):
    created_at = db.Column(db.DateTime(),
                           default=datetime.utcnow,
                           nullable=False)
    updated_at = db.Column(db.DateTime(),
                           default=None,
                           onupdate=datetime.utcnow)


# https://bitbucket.org/zzzeek/sqlalchemy/issues/3467/array-of-enums-does-not-allow-assigning
class ArrayOfEnum(ARRAY):
    def bind_expression(self, bindvalue):
        return cast(bindvalue, self)