Questions tagged [pyramid]

Pyramid is a Python-based web framework provided by the Pylons Project. Do not use the "pyramid" tag for displaying items in a pyramid shape.

Pyramid is a small, fast, down-to-earth Python web application development framework that is un-opinionated and very flexible. This allows it to be used in a variety of different projects where Pyramid's flexibility allows for easier integration with already-existing code/modules. Because it is un-opinionated it gives the developer a lot of choice in how to handle various aspects - such as sessions, authentication, authorization and more - without sacrificing support for those aspects or out-of-box ease of use.

It is developed as part of The Pylons Project. It is licensed under a BSD-like license with extra clauses.

Official Logo

Official Pyramid Logo

Official Icon

Official Pyramid Icon

2212 questions
163
votes
17 answers

SQLAlchemy - Getting a list of tables

I couldn't find any information about this in the documentation, but how can I get a list of tables created in SQLAlchemy? I used the class method to create the tables.
sidewinder
  • 3,013
  • 6
  • 24
  • 33
78
votes
8 answers

How to get column names from SQLAlchemy result (declarative syntax)

I am working in a pyramid project and I've the table in SQLAlchemy in declarative syntax """models.py""" class Projects(Base): __tablename__ = 'projects' __table_args__ = {'autoload': True} I get the results by using """"views.py""" session…
Sukumar
  • 3,502
  • 3
  • 26
  • 29
69
votes
10 answers

SQLAlchemy cannot find a class name

Simplified, I have the following class structure (in a single file): Base = declarative_base() class Item(Base): __tablename__ = 'item' id = Column(BigInteger, primary_key=True) # ... skip other attrs ... class Auction(Base): …
Ross
  • 46,186
  • 39
  • 120
  • 173
62
votes
5 answers

sqlalchemy existing database query

I am using SQLAlchemy as ORM for a python project. I have created few models/schema and it is working fine. Now I need to query a existing MySQL database, no insert/update just the select statement. How can I create a wrapper around the tables of…
DevC
  • 7,055
  • 9
  • 39
  • 58
58
votes
5 answers

SQLAlchemy boolean value is None

I have this table in my Pyramid app class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) ..... is_active = Column(Boolean, unique=False) def __init__(self, name, raw_password): is_active =…
user1012451
  • 3,343
  • 7
  • 29
  • 33
49
votes
3 answers

Should I use Pylons or Pyramid?

I was planning to move from Django to Pylons, but then I bumped into Pyramid. What are the differences between Pylons and Pyramid? I read some text in PylonsBook, which currently covers Pylons 0.9.7, and wonder if it is a to start for Pylons and…
AbdAllah
  • 753
  • 2
  • 7
  • 14
48
votes
3 answers

Make sure only one worker launches the apscheduler event in a pyramid web app running multiple workers

We have a web app made with pyramid and served through gunicorn+nginx. It works with 8 worker threads/processes We needed to jobs, we have chosen apscheduler. here is how we launch it from apscheduler.events import EVENT_JOB_EXECUTED,…
Ranjith Ramachandra
  • 10,399
  • 14
  • 59
  • 96
45
votes
1 answer

ArgumentError: relationship expects a class or mapper argument

I am getting this strange error, and I'm saying strange because I made a change to an unrelated table. I am trying to query my tDevice table which looks like this: class TDevice(Base): __tablename__ = 'tDevice' ixDevice = Column(Integer,…
john
  • 3,949
  • 7
  • 34
  • 56
42
votes
1 answer

User Authentication in Pyramid

I'm building a webapp and needed to choose between Django and Pyramid. I decided to go with Pyramid. I understand Pyramid comes with its own authentication/authorization framework which looks nice. But I haven't seen anywhere in Pyramid where…
lostdorje
  • 6,150
  • 9
  • 44
  • 86
37
votes
5 answers

get table columns from sqlAlchemy table model

I have a table where I would like to fetch all the column names however after browsing the interwebs I could not find a way that works. This is what my table looks like: class myTable(Base): __tablename__ = 'myTable' col1 = Column(Integer,…
john
  • 3,949
  • 7
  • 34
  • 56
26
votes
2 answers

What does '@reify' do and when should it be used?

I saw it in the Pyramid tutorial for UX design. I couldn't make out much what this decorator is all about. Sample code where I saw its usage. def __init__(self, request): self.request = request renderer =…
Sushant Gupta
  • 8,980
  • 5
  • 43
  • 48
25
votes
9 answers

uWSGI Fails with No module named encoding Error

I am trying to setup uWSGI with Pyramid, but I am getting this error, when attempting uwsgi --ini-paste development.ini Python version: 3.2.3 Error message: uwsgi socket 0 bound to UNIX address /tmp/uwsgi.sock fd 3 Python version: 3.2.3 (default,…
Dev Maha
  • 1,133
  • 1
  • 11
  • 24
24
votes
3 answers

Is Pyramid ready/recommended for prime time?

I was wandering around testing various options for my new personal project, ranging from PHP, to node.js, to Haskell. I feel most comfortable with Python, though, so I thought I'd go back to it in the end. I've taken a second look at frameworks like…
user234932
22
votes
3 answers

AttributeError: 'InstrumentedList' object has no attribute

I have these tables tables: class Thing(Base): __tablename__ = 'thing' id = Column(Integer, primary_key=True) class User(Base): __tablename__ = 'user' id = Column(Integer, primary_key=True) class Voteinfo(Base): __tablename__ =…
Jonathan Ong
  • 19,927
  • 17
  • 79
  • 118
22
votes
1 answer

When should I be calling flush() on SQLAlchemy?

I'm new to SQLAlchemy and have inherited a somewhat messy codebase without access to the original author. The code is litered with calls to DBSession.flush(), seemingly any time the author wanted to make sure data was being saved. At first I was…
blocks
  • 908
  • 2
  • 7
  • 14
1
2 3
99 100