Questions tagged [python-elixir]

A Python library that sits upon SQLAlchemy

Elixir is a Python library that sits on top of SQLAlchemy. Questions using this tag should also be tagged .

Further reading:

76 questions
4
votes
1 answer

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 + 1 However, this doesn't work reliably with…
Pankrat
  • 5,206
  • 4
  • 31
  • 37
4
votes
2 answers

Is elixir out-dated?

My sqlalchemy is 0.6.3, and elixir is 0.7.1 I created a model class which extends Entity: from elixir import * class User(Entity): pass And save the a user as: user = User() user.save() It reports Session has no attribute 'save' I looked into…
Freewind
  • 193,756
  • 157
  • 432
  • 708
4
votes
2 answers

SQLAlchemy and Elixir?

I have been using django ORM, it's nice and very easy, but this time I'm doing a desktop app and I found SQLAlchemy, but I'm not sure to use it with Elixir. What do you think? is it really useful?
sacabuche
  • 2,781
  • 1
  • 27
  • 35
3
votes
2 answers

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 SQLAlchemy/declarative models directly in Camelot. There…
boadescriptor
  • 735
  • 2
  • 9
  • 29
3
votes
2 answers

Elixir for Python 3?

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? Thanks in advance.
LEMUEL ADANE
  • 8,336
  • 16
  • 58
  • 72
3
votes
1 answer

Elixir reflection

I define some Entities which works fine; for meta programming issues. I now need to reflect the field properties defined in the model. For example: class Foo(Entity): bar = OneToMany('Bar') baz = ManyToMany('Baz') Which type of relation…
ElixirMixer
3
votes
2 answers

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, mainly for CRUD operations, listing, filtering,…
ychaouche
  • 4,922
  • 2
  • 44
  • 52
2
votes
1 answer

Deleting rows in a ManyToMany intermediate table

I have two tables with a ManyToMany relation between them. Sometimes I need to refresh the database so I delete elements from both tables. However relations between deleted rows are still stored inside the automatically created intermediary…
ixio
  • 56
  • 7
2
votes
3 answers

How to create a non-persistent Elixir/SQLAlchemy object?

Because of legacy data which is not available in the database but some external files, I want to create a SQLAlchemy object which contains data read from the external files, but isn't written to the database if I execute session.flush() My code…
siebert
  • 155
  • 2
  • 7
2
votes
0 answers

Multiple foreign keys to same table using Elixir

I am new to ORMs in general. I have a table (lets call it Entity) with columns -- ID expression type ( can be 'long_word', 'short_word' or 'sentence' ) Often, the first two types occur in a 'sentence', so, I want to maintain another table which…
Suvir
  • 175
  • 8
1
vote
0 answers

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 doesn't seem to be able to reflect the…
1
vote
1 answer

Elixir (SqlAlchemy): relations between 3 tables with composite primary keys

I've 3 tables: A Company table with (company_id) primary key A Page table with (company_id, url) primary key & a foreign key back to Company An Attr table with (company_id, attr_key) primary key & a foreign key back to Company. My question is how…
EoghanM
  • 25,161
  • 23
  • 90
  • 123
1
vote
1 answer

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…
Victor Neo
  • 3,042
  • 1
  • 17
  • 13
1
vote
1 answer

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 #!/usr/bin/python import t_model import threading…
Reno
  • 232
  • 1
  • 8
1
vote
2 answers

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, obviously): class Asset(Entity): has_field('Name',…
MFB
  • 19,017
  • 27
  • 72
  • 118