» Home » sqlalchemy » Page 1
Migrating from SQLObject to SQLAlchemy :: Can SQLAlchemy support zero caching and autoload table updates?
Category : Programming Languages

I want to know if SQLAlchemy can support instant loading of the current state of an object from the database when another process updates some attributes of the same object.

I want to mention, I am migrating from SQLObject to SQLAlchemy. Using SQLObject, currently, I have one table like:

class MyConfiguration(SQLObject):
class sqlmeta:

View Replies

How Can I Automatically Populate SQLAlchemy Database Fields? (Flask-SQLAlchemy)
Category : Databases

I've got a simple User model, defined like so:

# models.py
from datetime import datetime
from myapp import db
class User(db.Model):
id = db.Column(db.Integer(), primary_key=True)
email = db.Column(db.String(100), unique=True)
password = db.Column(db.String(100))
date_updated = db.Column(db.DateTime())
def __init__(self, email, pas

View Replies

Many-to-many in sqlalchemy. Preventing SQLAlchemy from inserting into a table if a tag already exists
Category : Programming Languages

I have a few ORM mapped tables, which (pared down) look like this:

class Tag(Base):
__tablename__ = 'tags'
tag_name = Column(String, primary_key=True)
task2tag_assoc = Table('tasktags', Base.metadata,
Column('task_id', UUID, ForeignKey('tasks.task_id', ondelete='cascade'),
Column('tag_name', String, Fore

View Replies

Managing seed data with SqlAlchemy and SqlAlchemy-migrate
Category : Programming Languages

I'm using SqlAlchemy in my Pylons application to access data and SqlAlchemy-migrate to maintain the database schema.

It works fine for managing the schema itself. However, I also want to manage seed data in a migrate-like way. E.g. when ProductCategory table is created it would make sense to seed it with categories data.

Looks like SqlAlchemy-migrate does not support thi

View Replies

Postgres inheritance with SQLAlchemy: SQLAlchemy Relationships
Category : Databases

I have many types of authentications, therefore I have one base postgres table (called "authentications"), and other types of authentications are derived from it. For example, an entity that gets authenticated using a password is called "password_authentications" and it inherits from the "authentications" table using postgres. The schema is thus:

CREATE TABLE authentications (
View Replies

flask-sqlalchemy or sqlalchemy
Category : Databases

I am new in both flask and sqlalchemy, I just start working on a flask app, and I am using sqlalchemy for now. I was wondering if there is any significant benefit I can get by using the package flask-sqlalchemy vs the sqlalchemy. I could not find enough motivations in http://packages.python.org/Flask-SQLAlchemy/index.html or maybe I did not understand the value!! I would appreciate your clarifi

View Replies

just one row from sqlalchemy
Category : Programming Languages
import re
from sqlalchemy import *
db = create_engine('sqlite:///code.db')
db.echo = True
metadata = MetaData(db)
halo4 = Table('emblem_codes', metadata, autoload=True)
## Get One Unused Code ##
s = select([halo4.c.code, halo4.c.status=='None'])
result = s.execute()
for row in result:
View Replies

Locking in sqlalchemy
Category : Programming Languages

I'm confused about how to concurrently modify a table from several different processes. I've tried using Query.with_lockmode(), but it doesn't seem to be doing what I expect it to do, which would be to prevent two processes from simultaneously querying the same rows. Here's what I've tried:

import time
from sqlalchemy.orm import sessionmaker, scoped_session
from sqlalch

View Replies

Category : Programming Languages

I'd like to represent the following query in SQLAlchemy:

select * from table where bit_count(column & bitmask) > 5

Basically I'm looking to select any row with a certain count of flags set. However, SQLAlchemy doesn't seem to have defined the BIT_COUNT() function. Anyone know any tricks to make this query in SQLAlchemy?

View Replies


Is there anything similar to SQLAlchemy?
Category : Programming Languages

I've recently started to fell in love with SQLAlchemy. You can write clean and fast SQL statements without having to write one line of SQL. There is no need to write most of the meta configuration you would need for something like Hibernate. At work I managed to create a mapper for a table which doesn't have a primary key! I can have composite primary keys, no need to spread an id column over a

View Replies

2012 / 2017 Copyrights BigHow , All Rights Reserved .