I really like the feature of SQLAlchemy that allows you to see if an object is dirty: if it has been modified since it was retrieved from the database, or the last time it was saved.
Is it possible to find this information from the Django ORM?
Note this is not the same as Dirty fields in django, as I don't care about what the previous ...
I am currently playing around with SQLAlchemy a bit, which is really quite neat.
For testing I created a huge table containing my pictures archive, indexed by SHA1 hashes (to remove duplicates :-)). Which was impressingly fast...
For fun I did the equivalent of a select * over the resulting SQLite database:
session = Session()
for p i...
Has anyone used SQLAlchemy in addition to Django's ORM?
I'd like to use Django's ORM for object manipulation and SQLalchemy for complex queries (like those that require left outer joins).
Is it possible?
Note: I'm aware about django-sqlalchemy but the project doesn't seem to be production ready.
...
Suppose that I have a table like:
class Ticker(Entity):
ticker = Field(String(7))
tsdata = OneToMany('TimeSeriesData')
staticdata = OneToMany('StaticData')
How would I query it so that it returns a set of Ticker.ticker?
I dig into the doc and seems like select() is the way to go. However I am not too familiar with the sql...
How close can I get to defining a model in SQLAlchemy like:
class Person(Base):
pass
And just have it dynamically pick up the field names? anyway to get naming conventions to control the relationships between tables? I guess I'm looking for something similar to RoR's ActiveRecord but in Python.
Not sure if this matters but I'll...
Does anyone have experience profiling a Python/SQLAlchemy app? And what are the best way to find bottlenecks and design flaws?
We have a Python application where the database layer is handled by SQLAlchemy. The application uses a batch design, so a lot of database requests is done sequentially and in a limited timespan. It currently tak...
I'm not quite sure what i mean here, so please bear with me..
In sqlalchemy, it appears i'm supposed to pass an expression? to filter() in certain cases. When i try to implement something like this myself, i end up with:
>>> def someFunc(value):
... print(value)
>>> someFunc(5 == 5)
True
How do i get the values passed to == from ...
How should new nodes be added with SQLAlchemy to a tree implemented using the Nested Set Model?
class Category(Base):
__tablename__ = 'categories'
id = Column(Integer, primary_key=True)
name = Column(String(128), nullable=False)
lft = Column(Integer, nullable=False, unique=True)
rgt = Column(Integer, nullable=False,...
I'm trying to do something relatively simple, spit out the column names and respective column values, and possibly filter out some columns so they aren't shown.
This is what I attempted ( after the initial connection of course ):
metadata = MetaData(engine)
users_table = Table('fusion_users', metadata, autoload=True)
s = users_table....
I have text files with a lot of uniform rows that I'd like to load into a mysql database, but the files are not completely uniform. There are several rows at the beginning for some miscellaneous information, and there are timestamps about every 6 lines.
"LOAD DATA INFILE" doesn't seem like the answer here because of my file format. It d...
What's the right way to control timeouts, from the client, when running against a MySQL database, using SQLAlchemy? The connect_timeout URL parameter seems to be insufficient.
I'm more interested in what happens when the machine that the database is running on, e.g., disappears from the network unexpectedly. I'm not worried about the ...
I'm trying to add two new object using session.add(object) twice..but the first object disappear on session.commit()...why it happens?
...
I am using SQLAlchemy to make database-independent querys.
I am facing one issue with to_char function.
Consider the simple query like:
select to_char(id,'999') from xyz
It's working on Postgres but MySQL doesn't support it.
How can I make this query database-independent using SQLAlchemy?
...
Hi
I'm trying to build an elixir model in which I have a class with a list(of variable size) of tuples.
One example would be a recipe
while I can do something like this:
class Recipe(Entity):
ingrediants = OneToMany('IngrediantList')
cooking_time = Field(Integer)
...
class IngrediantList(Entity):
ingrediant = ManyToO...
Hello,
I am new to databases, and would like to know how to best store personal messages in a database (with SQLAlchemy).
Because I wasn't sure, I have tried the following table for PMs
pm_table = Table('personal_message', metadata,
Column('id', Integer, primary_key=True, autoincrement=True),
Column('from_id', Integer, Forei...
Consider a table like this:
| Name | Version | Other |
| ---------------------|-------|
| Foo | 1 | 'a' |
| Foo | 2 | 'b' |
| Bar | 5 | 'c' |
| Baz | 3 | 'd' |
| Baz | 4 | 'e' |
| Baz | 5 | 'f' |
--------------------------------
I would lik...
I access a a postgres table using SQLAlchemy. I want a query to have eagerloading.
from sqlalchemy.orm import sessionmaker, scoped_session, eagerload
from settings import DATABASE_USER, DATABASE_PASSWORD, DATABASE_HOST, DATABASE_PORT, DATABASE_NAME
from sqlalchemy import create_engine
from sqlalchemy import Table, Column, Integer, Strin...
I want a record from a table(queue) to be selected, locked(no other process can edit this record) and updated at a later point in time.
I assumed if I put the whole querying and updating in a transaction, no other process can edit/query the same record. But I am not quite able to achieve this.
def move(one, two):
from settings import ...
Lets say that I have a database structure with three tables that look like this:
items
- item_id
- item_handle
attributes
- attribute_id
- attribute_name
item_attributes
- item_attribute_id
- item_id
- attribute_id
- attribute_value
I would like to be able to do this in SQLAlchemy:
item = Item('item1')
item.foo = 'bar'
ses...
I have been working on a website using mod_python, python, and SQL Alchemy when I ran into a strange problem: When I query the database for all of the records, it returns the correct result set; however, when I refresh the page, it returns me a result set with that same result set appended to it. I get more result sets "stacked" on top o...