1
vote
0answers
5 views

SQLAlchemy aliases not aliasing?

I have the following sqlalchemy code: x = bbc.alias().c w = bbc.alias().c select([func.distinct(x.region)]).where( select([func.sum(w.population)]).where((w.region == x.region)) > 100000000 ) ...
-1
votes
0answers
10 views

Python reports generator with Excel capability

does any one know a great tool for generating reports with python? i am using SQLAlchemy to work with the database, and i need a tool, to which i could provide data and it create a report, should ...
0
votes
1answer
11 views

Insert new one-to-many data into tables with SQLAlchemy ORM

I'm trying to insert rows into a database that has three tables: Artists Songs Media (like a youtube video) Artists has a one-to-many relationship with Songs and Songs has one-to-many relationship ...
0
votes
0answers
12 views

update tables with computed columns in sqlalchemy

I'm working in a legacy MSSQL database using SQLalchemy, for which I have a declarative mapping. This database has several tables that have computed columns. I can read them fine, but (of course) ...
0
votes
2answers
18 views

UnicodeEncodeError:'latin-1' codec can't encode characters in position 0-1: ordinal not in range(256)

i am a newer in python.Today when I write some search function I met an error.well, I use sqlalchemy orm to do that, in my function,I input a chinese word as the key word.The html page give me an ...
0
votes
1answer
20 views

Get attribute of object from relationship in sqlalchemy

Consider the following code defining some classes: from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, Integer, Float, String, DateTime from sqlalchemy import ...
0
votes
1answer
21 views

What is the proper way to model this type of inheritance with SQLAlchemy?

I have a pair of PostgreSQL tables that look somewhat like this (simplified example): CREATE TABLE people ( id SERIAL PRIMARY KEY, created timestamp with time zone DEFAULT now() NOT NULL, ...
2
votes
1answer
22 views

SQLAlchemy with single table inheritance expunge error

I'm having an issue with python SQLAlchemy single table inheritance. Model: class User(Base): __tablename__ = 'user' userID = Column(String(64), primary_key=True) name = ...
2
votes
1answer
33 views

query from sqlalchemy returns AttributeError: 'NoneType' object

from pox.core import core import pox.openflow.libopenflow_01 as of import re import datetime from sqlalchemy import create_engine, ForeignKey from sqlalchemy import Column, Date, Integer, String from ...
0
votes
1answer
23 views

error in sqlalchemy after replacing count query with exists query [duplicate]

class SourcetoPort(Base): """""" __tablename__ = 'source_to_port' id = Column(Integer, primary_key=True) port_no = Column(Integer) src_address = Column(String,index=True) ...
0
votes
0answers
36 views

SQLAlchemy error MySQL server has gone away

Error OperationalError: (OperationalError) (2006, 'MySQL server has gone away') i'm already received this error when i coded project on Flask, but i cant understand why i get this error. I have code ...
1
vote
1answer
16 views

get attribute names of class python/ get column names of query

I want to have the column names of my sqlalchemy query but I do not find how I can do this. I tried a few ways first way I have tried was to make a new class, because the names had to be different ...
0
votes
1answer
30 views

sqlalchemy create_engine() if the db already exists

from pox.core import core import pox.openflow.libopenflow_01 as of import re import datetime from sqlalchemy import create_engine, ForeignKey from sqlalchemy import Column, Date, Integer, String from ...
0
votes
1answer
25 views

querying data from sqlalchemy database

engine = create_engine('sqlite:///nwtopology.db', echo=False) Base = declarative_base() class SourcetoPort(Base): """""" __tablename__ = 'source_to_port' id = Column(Integer, ...
0
votes
1answer
12 views

How to generate this query in sqlalchemy?

this query used to_char abd group_by select to_char(date_published, 'yyyymm') yo from blog group by yo; i have try In [3]: year_field = db.func.extract('year', ArticleModel.date_published) In ...
0
votes
0answers
26 views

How to maintain part of data in one table using flask-admin view?

I have a table "Label" with columns : id | name | type The type column get 3 values:"Category","Tags","MAT", so that this one table contains three type of data. Now, I want to only maintain the ...
1
vote
1answer
32 views

SQLAlchemy + Requests Asynchronous Pattern

I am currently working on an application where a client makes some call to a web services, some small amount of processing is done on the JSON data returned, and then that is stored in a database. I ...
0
votes
1answer
38 views

SqlAlchemy look-ahead caching?

Edit: Main Topic: Is there a way I can force SqlAlchemy to pre-populate the session as far as it can? Syncronize as much state from the database as possible (there will be no DB updates at this ...
0
votes
1answer
17 views

Connecting to a firebird superserver on windows using sqlalchemy

I am trying to connect to a firebird super server.I have the fdb package installed. I am trying from sqlalchemy import create_engine engine = create_engine ('localhost:c:\fdbb\school.fdb') I get ...
0
votes
0answers
15 views

Accessing Postgres Namespaces from SQLAlchemy

Is it possible to create Postgresql namespaces for sets of tables from SQLAlchemy?
2
votes
3answers
35 views

How to check whether SQLAlchemy session is dirty or not

I have a SQLAlchemy Session object and would like to know whether it is dirty or not. The exact question what I would like to (metaphorically) ask the Session is: "If at this point I issue a commit() ...
0
votes
0answers
22 views

Structuring a SQLAlchemy CRUD Application

I've been writing my first application of a fair size (~ 4000 lines) and my first application that uses a database for persistence. It uses Python + SQLAlchemy. I've been struggling with the structure ...
0
votes
1answer
19 views

Compare Dates With SQLAlchemy One-To-Many Relationships

How do you compare dates for one-to-many SQLAlchemy relationships? Basically for my model structure, there is a one to many relationship between Team and Player: class Team(db.Model): ...
0
votes
1answer
29 views

Comparing Dates with SQLAlchemy, SQLite

I am writing an application that uses SQLAlchemy with an SQLite database. I believe my database, tables, and mapping are configured correctly because other operations work as expected. I am trying ...
0
votes
0answers
26 views

SQLAlchemy A conflicting state is already present in the identity map for key

I'm using the Flask-SqlAlchemy extension around SQLAlchemy to work with a SQLite database in Python. I have a many-to-many relationship set up between "Format" and "Movie" models. I have successfully ...
0
votes
1answer
15 views

Remapping an SQLAlchemy inheritance relation to a different postgres schema

If I have a simple join-based inheritance relationship in SQLAlchemy that I've replicated between schemas using "SET search_path", how can I access them simultaneously in order to do a copy between ...
0
votes
0answers
31 views

Is Google App Engine NDB and SQLAlchemy similar? [closed]

I am a big fan of Python. I am learning to write web apps, and I chose GAE to place my app (due to many reasons: free tier, simple-to-start, etc). I am developing based on ...
1
vote
0answers
22 views

Avoid retrieving object to delete in many to many rel SQLAlchemy

Is there a way to avoid retrieving an object to delete in many-to-many relationship? assign = Table('manytomany', Base.metadata, Column('pid', String(...), ForeignKey('parent.pid')), ...
0
votes
2answers
42 views

SQLAlchemy / Python / Pyramid Write To Database Issue

The problem: I am working on a bit of code that is meant to create a new record in a linking table. The linking table has a primary key that is an auto number, the other two fields are VARCHAR with a ...
0
votes
1answer
77 views

Using SQLAlchemy on App Engine development server

I have seen some questions about using SQLAlchemy on App Engine to connect to Google Cloud SQL. But I'm not sure if it is possible to develop using a local MySQL database and the existing SQLAlchemy ...
0
votes
2answers
55 views

parsing nested logic from strings in python

I need to turn a string of the form: 'a==1&&(b==2||(c==3||d==4&&e==5)&&f==6)||(g==7&&h==8)' into sqlalchemy logic to be filtered (via or_ and and_). The first step ...
0
votes
1answer
21 views

How to cast a child instance from a parent instance in SQLalchemy with joined inheritance

Given a simple joined inheritance in SQLAlchemy, what's the simplest way to "cast" an instance of the superclass to it's subclass? The obvious way is to check the discriminator on the superclass and ...
0
votes
0answers
21 views

SQLAlchemy : Building dynamic joins for a query

I'd want to make an API that takes in parameter a list of columns from different tables and build the query correctly. I don't know what I should do specify to SQLAlchemy how it will determine the ...
1
vote
1answer
39 views

SQLAlchemy filter in_ operator

I am trying to do a simple filter operation on a query in sqlalchemy, like this: q = session.query(Genotypes).filter(Genotypes.rsid.in_(inall)) where inall is a list of strings Genotypes is ...
1
vote
1answer
32 views

SQLAlchemy __init__ not runnning

I have the following code: session = scoped_session(sessionmaker(autocommit=False, autoflush=True, bind=engine)) Base = declarative_base() Base.query = session.query_property() class ...
0
votes
0answers
30 views

Using postgresql xml data type with sqlalchemy

SqlAlchemy supports most database specific data types via dialects, but I could not find anything to work with the postgresql xml column type. Does somebody know a working solution. Idealy it should ...
1
vote
1answer
51 views

How to get a SQLAlchemy session managed by zope.transaction that has the same scope as a http request but that does not close automatically on commit?

I have a Pyramid web application with some form pages that reads data from database and write to it as well. The application uses SQLAlchemy with a PostgreSQL database and here is how I setup the ...
0
votes
1answer
45 views

AttributeError: 'int' object has no attribute '_sa_instance_state'

I'm working on forum template using Flask. When I attempt creating a new thread in the browser using forms, SQLAlchemy throws an AttributeError. The problem showed up when I tried implementing a ...
0
votes
1answer
48 views

Many to many helper table not being created in unit tests

I have a Flask app that uses SQLAlchemy and I'm having trouble getting my many to many relations working with my unit tests. In my setUp method I create my app and initialise my database like this: ...
0
votes
1answer
42 views

What needs to be installed along with google appengine for sqlalchemy / google cloud sql api?

I tried the recommendations in Can SQLAlchemy be used with Google Cloud SQL? to bring up an external connection to google cloud sql using sqlalchemy. To allow visibility of google appengine packages ...
0
votes
1answer
38 views

translate from SQL to SQLAlchemy

i have the following sql script. SELECT * FROM movies LEFT JOIN possession ON movies.id = possession.movie_id AND possession.master_id = ? WHERE possession.id is NULL ORDER BY movies.id DESC and ...
0
votes
1answer
16 views

SqlAlchemy: Refer to the bound session from an object?

Suppose I am using a declarative object like the following: class MyObject(DeclarativeBase): ... other_object_id = Column(Integer, ForeignKey('other_object.id')) other_object = ...
0
votes
1answer
39 views

SqlAlchemy: Join onto another object

My little website has a table of comments and a table of votes. Each user of the website gets to vote once on each comment. When displaying comments to the user, I will select from the comments table ...
2
votes
1answer
30 views

SQLAlchemy modelling a constraint based on a dictionary

i have a table like this: class Sample(Base): __tablename__ = 'sample' id = Column(Integer, primary_key=True) type = Column(Enum(u'Lion', u'Tiger', name='types')) color = ...
1
vote
1answer
50 views

Inserting relationships into a table which connects 3 tables with many to many relationships with SQLALchemy - python

Below you can see how some tables of my database are related. As you can see the table in the middle is connecting 3 tables with many-to-many relationships... One gene can be expressed in more ...
1
vote
1answer
44 views

flask sqlalchemy querying a column with not equals

I can query my seats table for all seats where there is no invite assigned: seats = Seat.query.filter_by(invite=None).all() However, when querying for all seats that have an invite assigned, I get ...
1
vote
0answers
47 views

SQLAlchemy audit logging; how to handle deletes?

I'm using a modified version of the versioning code example that comes with SQLAlchemy to record a user id and date on changes. However, I also want to modify it so deletes are done by marking a ...
1
vote
1answer
68 views

Invalid Syntax class Template(metaclass=_TemplateMetaclass) with mod_wsgi, apache and sqlalchemy

I have a script where I import: from bottle import route, request from sqlalchemy import create_engine, MetaData from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import ...
2
votes
1answer
24 views

SqlAlchemy: Convert inherited type from one to another

Let's say I have two different types both on the same database table (single table inheritance): class Employee(db.Model): id = db.Column(db.Integer, primary_key = True) name = ...
0
votes
1answer
23 views

SQLAlchemy relationship with association_proxy problems

I've been wading through many website to try to understand what's going on, but I really need some direct help. I'm sorry if I missed something obvious in the docs. Here's what I'm trying to do ...

1 2 3 4 5 42
15 30 50 per page