76 questions
8
votes
2
answers
3k
views
Difference between ":", "@" and nothing in python docstrings
I'm just trying to get a better feel for the layout of Python docstrings (Between the """ """)
I've seen docstrings with different layouts...such as...
"""
@DESCRIPTION
Ive seen tags STARTING with ...
0
votes
1
answer
245
views
"Expanding" a reflexive Many to Many relationship in SQLAlchemy
Using Elixir 0.7.1 and SQLAlchemy 0.7.8, I've created a model having a many-to-many relationship back to itself, which looks like:
from elixir import *
class MyModel(Entity):
name = Field(...
1
vote
1
answer
574
views
From Elixir to SqlAlchemy Declarative, Polymorphic Nodes with Child Inheritance [duplicate]
I have already finished a good bit of my python/Elixir interface on my existing database. I am now considering to drop Elixir and move everything into pure SQLAlchemy, most likely wanting to use ...
0
votes
1
answer
198
views
When to stop using Elixir? [closed]
If you have a python database wrapper using Elixir, with a pretty straightforward 'Active Record' design (1 object to 1 table), but then you begin to expand...
At what point should you stop using ...
0
votes
1
answer
693
views
Using python and elixir to send emails utilizing db tables with foreign keys
I have a python script that pulls information from a single database table and sends a weekly update email to users. I'd like to find a way to modify my code to allow for normalizing the structure and ...
0
votes
1
answer
203
views
Where do I commit changes to DB in QAbstractTableModel?
I'm writing an app using python2, qt and elixir. The app fetches data from the sqlite databate to a list of elixir objects and store that in a variable inside a QAbstractTableModel subclass I created ...
10
votes
4
answers
4k
views
Impossible to initialize Elixir
I'm starting with Elixir and SQL Alchemy. I've created a python file connecting with a Mysql database to but as soon as I execute with python I get the error bellow:
root@raspberrypi:/Python/...
0
votes
1
answer
108
views
Creating a Generative Search with Elixir
I'm stuck using Elixir and I currently have a really messy way of searching through a database that i'd like to improve. The documentation provides insight on how to do a basic generative search but I ...
0
votes
1
answer
232
views
UnitTest : Can't add many to many relations : Integrity error (seems delete do not do his job)
I have two tables : Person & Team ; each has a Many-To-Many relation with the other.
I do this in the setUp function (called before each function of testing, 3 times in my case)
p = Person(fname=...
0
votes
1
answer
74
views
Is it possible to tag elixir/sqlalchemy fields/columns with extra properties?
I'd like to mark some columns in my entities as Searchable -- ideally in a clean way, on a per-column basis. Is it possible to "tag", or add a property to the column definition in the class? Elsewhere ...
0
votes
1
answer
2k
views
Length Limit for MySQL Identifiers (table names, column names) using SQLAlchemy with Elixir
I am using SQLAlchemy with Elixir and everything works fine using SQLite. However, when I switch to MySQL there is a table name and column name length limit (64 characters). I have quite a lot of ...
1
vote
1
answer
438
views
Base entity with concrete inheritance
I want to have a base entity with a field deleted which marks a deleted record. And i have 2 subclasses, each of them to have their own table with all own columns:
from elixir import *
from ...
6
votes
1
answer
2k
views
SQLAlchemy declarative extension vs. elixir
I am planning to use SQLAlchemy in one of my projects and i am very interested in declarative syntax of tables.
I was told to use the Elixir Declarative Layer for that, at the same time SQLAlchemy ...
1
vote
0
answers
427
views
SQLAlchemy/Elixir syntax for relationships on existing databases
I'm trying to build Python models using Elixir representing tables in an existing MySQL database connected via a mysql+pyodbc connection string. Elixir reflects the column structure effortlessly, but ...
3
votes
2
answers
913
views
Is Python Camelot tied to Elixir?
The docs for Camelot say that it uses Elixir models. Since SQLAlchemy has included declarative_base for a while, I had used that instead of Elixir for another app. Now I would like to use the ...
0
votes
1
answer
1k
views
Using Flask with Elixir and SQL alchemy
I am trying to use Elixir with Flask. Reason being using SQL Alchemy directly has me confused about the data insert on Many to Many relations. So I have created the models file and generated the ...
0
votes
1
answer
272
views
SQLAlchemy insert millions data inefficiently
It takes a long time to finish 100000 (user,password) tuple insertions.
def insertdata(db,name,val):
i = db.insert()
i.execute(user= name, password=val)
#-----main-------
tuplelist = readfile(...
0
votes
1
answer
193
views
How to order by count of many to many relation with Elixir?
Use Elixir and have two entities -- Voter and Candidate -- with many to many between them(voter can vote for many candidates if it matters). Want to get list of Candidate's sorted by amount of voters. ...
0
votes
1
answer
213
views
How to make customizable "order by" for many-to-one relation to itself in Elixir or SQLAlchemy?
We have entity Node:
class Node(Entity):
parent = ManyToOne('Node')
children = OneToMany('Node')
When we query like this:
nodes = (
Node.query
.options(
eagerload(Node....
4
votes
2
answers
889
views
How to iterate through every class declaration, descended from a particular base class?
I was wandering how does elixir\sqlalchemy get to know all the entity classes I've declared in my model, when I call setup_all()? I need that kind of functionality in a little project of mine, but I ...
0
votes
2
answers
299
views
Non-existent column when using SQLite and MySQL with Elixir but not when used separately
In my plugin for Qgis I have to use two databases, SQLite and MySQL at the moment, for interfacing with them I use Elixir 0.7.1 and SqlAlchemy 0.7.4. When I only used SQLite, everything was fine, ...
0
votes
1
answer
362
views
Python Elixir OneToMany and ManyToOne implementation: On Inserting new record with OneToMany relationship?
How do you insert a record with one to many relationship in Python Elixir? See code below.
from elixir import *
class Product(Entity):
using_options(shortnames=True)
name = Field(Unicode)...
3
votes
2
answers
1k
views
Elixir for Python 3? [closed]
I have a problem installing Elixir with Python 3 although I have installed SqlAlchemy 0.7.3 successfully? I've tried google-ing but I am loosing hope. Is there really a version of Elixir for Python 3? ...
-1
votes
1
answer
113
views
Elixir EntityCollection.remove() doesn't work
I'm trying to remove a certain Entity from the collection in a EntityCollection, which is not working, results in an exception: list.remove(x): x not in list.
Code excerpt as follows:
user....
1
vote
1
answer
1k
views
Order by Count of OneToMany Elixir Relationship
I am using Elixir for ORM but I have a problem trying to Order by a Relationship.
What I am trying to do is to get a list of users sorted by the number of posts they have. I have tried ways such as
...
8
votes
4
answers
6k
views
MySQL server has gone away - Disconnect handling via checkout event handler doesn't work
Update 3/4:
I've done some testing and proved that using checkout event handler to check disconnects works with Elixir. Beginning to think my problem has something to do with calling session.commit() ...
0
votes
2
answers
727
views
How to create a class attribute and class property within Elixir/SqlAlchemy
I have a class:
from sys import stderr
from elixir import *
from types import *
class User(Entity):
using_options(tablename="users")
first_name = Field(String(50))
middle_name = Field(...
1
vote
1
answer
778
views
Why does Elixir/SQLAlchemy's session.bind get set to None within threads?
I'll start with some simplified test code to demonstrate the issue I'm referencing.
t_model.py
from elixir import *
metadata.bind = 'sqlite:///test.db'
session.bind = metadata.bind
t_main.py
#!/...
1
vote
2
answers
208
views
How to create an Elixir class that has a ManyToMany relationship with itself
I'm having trouble thinking this through, but basically I want to create an Elixir class called Assets which can have many Assets. So, it could look something like this (but this doesn't work, ...
1
vote
1
answer
274
views
How do you save models in Elixir
I've got a database created using Django models which I'm now accessing using SQLAlchemy and Elixir. The querying works and I can pull items out of the database perfectly happily but when I edit them ...
5
votes
1
answer
2k
views
Using sqlalchemy.sql.functions.char_length as a filter condition
I'm using Elixir and sqla 0.6, and I'm trying to query my model:
class Document(Entity):
using_options(shortnames=True, order_by='doc_date')
doc_number = Field(Unicode(20),index=True)
......
-3
votes
1
answer
356
views
how to create index in elixir? by using sqlalchemy or what? [closed]
I'm using elixir, and I cannot find any index creation method,
and I'm not familiar with sqlalchemy, any examples?
1
vote
1
answer
896
views
SQLAlchemy/Elixir - querying to check entity's membership in a many-to-many relationship list
I am trying to construct a sqlalchemy query to get the list of names of all professors who are assistants professors on MIT. Note that there can be multiple assistant professors associated with a ...
0
votes
1
answer
192
views
How to reference Python elixir object items
I am trying to swap in the key name from a request.param for an Elixir object attribute. Below, the Elixir object bk is a Book() which has an attribute PrintTitle. PrintTitle also comes in from a ...
0
votes
1
answer
283
views
How do you make codes/lookup tables in Elixir? [closed]
I am looking for a/the best way to make lookup tables or use codes in a relational database made from Python's Elixir. I am not even sure my terminology here is correct.
For example, I have a ...
1
vote
1
answer
272
views
how to leave a computed field alone when writing to db using Elixir session.commit()
I am using Elixir to connect to MSSQL database. The database has a table with a computed column in it. However, when I update other columns in the object and commit the changes, python tells me I can'...
0
votes
1
answer
707
views
SQLAlchemy model definition at execution
I'm writing an ORM using Elixir and SQLAlchemy to handle moving spreadsheet-like data into SQL. In general, the content of the spreadsheet-like data is unknown, and pyparsing parses (meta) data about ...
0
votes
1
answer
4k
views
SQLAlchemy IntegrityError
I'm having a problem using SQLAlchemy with PySide(PyQt). I'm trying to pop-up a QtGui.QDialog, but when I do this SQLAlchemy throws an exception:
Traceback (most recent call last):
File "C:\...
0
votes
2
answers
1k
views
Problem querying from a model object
I'm trying to use Pylons with SqlAlchemy (through Elixir).
Here is my testdb/model/entities.py:
from elixir import *
metadata.bind = "mysql://testdb:hundertwasser@localhost/testdb"
metadata.bind....
1
vote
1
answer
1k
views
Is there an equivalent of ActiveRecord's find(:include) in Elixir/SQLAlchemy?
I had been using ActiveRecord previously and it allowed to load all associations of an object using an optional :include argument to its dynamic finders. I have recently started using Elixir for a ...
0
votes
1
answer
582
views
query.values fails with Elixir
I have a problem with the Elixir declarative layer; I want to retrieve, for every instance of my model, the data of a particular column, like this:
File.query.values("column")
The thing is, it only ...
0
votes
1
answer
539
views
How to perform an "UPDATE" with elixir
I'm using elixir/flask in a small web app I wrote for my own personal aggregator.
I'm trying to create a restful call to mark all items of a particular rssfeed as read.
The SQL statement would look ...
4
votes
1
answer
5k
views
How to do atomic increment/decrement with Elixir/SQLAlchemy
I'd like to increment (or decrement) a score field in an Elixir entity:
class Posting(Entity):
score = Field(Integer, PassiveDefault(text('0')))
def upvote(self):
self.score = self.score ...
11
votes
1
answer
4k
views
Should I be using SQLObject, SQLAlchemy, or SQLAlchemy + Elixir? [closed]
I've been using SQLObject for a long while, but noticed that SQLAlchemy has become a lot more popular in the last couple years: http://www.google.com/trends?q=sqlobject,+sqlalchemy
Are there ...
3
votes
2
answers
616
views
Feedback for Camelot
My needs :
I need to develop an GUI application that is cross platform
the chosen solution must be the fastest to implement
it should be easy to extend
The application is just a database front-end, ...
0
votes
1
answer
515
views
Loading Elixir/SQLAlchemy models in .NET?
A new requirement has come down from the top: implement 'proprietary business tech' with the awesome, resilient Elixir database I have set up. I've tried a lot of different things, such as creating an ...
0
votes
3
answers
613
views
Write update statement in Python Elixir
I'm using Elixir as my ORM for a MySQL database, I'm having problems writing an update statement, for instance:
"update products set price=NULL where id>100"
This is my Elixir clsee
class Product(...
7
votes
3
answers
4k
views
What are the benefits of using Elixir [closed]
... vs declarative sqlalchemy ?
0
votes
1
answer
390
views
Add new column on Elixir
I use Elixir as an ORM for a MySQL database. I want to add new column to my schema.
/
How can I keep the original data in MySQL and update the schema automatically? The concept is called migrate in ...
0
votes
1
answer
283
views
Sharing model between Camelot and non-Camelot apps
I would like to share my data model between different Elixir/SQLAlchemy applications, one of which would be a Camelot UI and the others stuff like web interfaces and so on. They would all connect to ...