GithubHelp home page GithubHelp logo

rolobio / dictorm Goto Github PK

View Code? Open in Web Editor NEW
12.0 5.0 4.0 486 KB

Use Postgresql/Sqlite as if it were a Python Dictionary

License: Apache License 2.0

Python 100.00%
python-dictionary database dict postgresql postgresql-orm sqlite sqlite-orm python-orm

dictorm's People

Contributors

codacy-badger avatar jean avatar rolobio avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

dictorm's Issues

Install fails without psycopg2 (sqlite is available)

It looks like this is due to these lines in pg.py:

from psycopg2.extensions import cursor                                                                                                             
mogrify = cursor.mogrify

It doesn't look like mogrify is used anywhere.

Here's the error:

$ pip install --user dictorm
Collecting dictorm
  Downloading dictorm-3.7.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "/data/data/com.termux/files/tmp/pip-build-0txo2_cf/dictorm/dictorm/dictorm.py", line 10, in <module>
        from dictorm.pg import Select, Insert, Update, Delete, And
      File "/data/data/com.termux/files/tmp/pip-build-0txo2_cf/dictorm/dictorm/pg.py", line 8, in <module>
        from psycopg2.extensions import cursor
    ModuleNotFoundError: No module named 'psycopg2'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/data/data/com.termux/files/tmp/pip-build-0txo2_cf/dictorm/dictorm/__init__.py", line 2, in <module>
        from dictorm.dictorm import * # pragma: no cover
      File "/data/data/com.termux/files/tmp/pip-build-0txo2_cf/dictorm/dictorm/dictorm.py", line 16, in <module>
        from .pg import Select, Insert, Update, Delete, And
      File "/data/data/com.termux/files/tmp/pip-build-0txo2_cf/dictorm/dictorm/pg.py", line 8, in <module>
        from psycopg2.extensions import cursor
    ModuleNotFoundError: No module named 'psycopg2'

Generated Columns are updated

DictORM attempts to update a generated column.

CREATE TABLE foo (
   id SERIAL PRIMARY KEY,
   text_row TEXT,
   id_times_2 INT GENERATED AS (id * 2) STORED
);
>>> Foo = db['foo']
>>> row = Foo().flush()
>>> row['text_row'] = 'foobar'
>>> row.flush()
psycopg2.errors.SyntaxError: column "id_times_2" can only be updated to DEFAULT
DETAIL:  Column "id_times_2" is a generated column.

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.