GithubHelp home page GithubHelp logo

sqlalchemy-defaults's People

Contributors

jacobsvante avatar kvesteri avatar oskarihiltunen avatar vesauimonen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sqlalchemy-defaults's Issues

Avoid hard dependency on psycopg2

Psycopg requires you to have PostgreSQL installed, which is kinda silly if you're not actually using postgres as the database backend. Is this only intended for postgres?

Min and max column info attrs are expected to be integers

The method append_check_constraints (https://github.com/kvesteri/sqlalchemy-defaults/blob/d92dd9a2dfb0291fc643adb1ea76b7b41233d4f7/sqlalchemy_defaults/__init__.py#L74-87) expects that the min and max column info attributes are integers. At least for Date and DateTime columns this is not the case. See example from WTForms-Alchemy's documentation regarding DateTime column and min attribute: http://wtforms-alchemy.readthedocs.org/en/latest/validators.html#range-validators.

server_default is None for string types?

Taking the code from your example:

import sqlalchemy as sa
from sqlalchemy_defaults import Column
from sqlalchemy.ext.declarative import declarative_base


Base = declarative_base()


class User(Base):
    __tablename__ = 'user'
    __lazy_options__ = {}
    id = Column(sa.Integer, primary_key=True)

    name = Column(
        sa.Unicode(255),
    )
    description = Column(
        sa.Unicode(255),
        default=u'',
    )

    is_admin = Column(
        sa.Boolean,
    )

    created_at = Column(
        sa.DateTime,
        auto_now=True
    )

    hobbies = Column(
        sa.Integer,
        min=1,
        max=4
    )

from sqlalchemy_defaults import make_lazy_configured


make_lazy_configured(sa.orm.mapper)

print('User.description.default:', User.description.default)
print('User.description.server_default:', User.description.server_default)

Running this code gives me:

User.description.default: ColumnDefault('')
User.description.server_default: None

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.