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

2188 questions
110
votes
12 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
  • 2,253
  • 6
  • 21
  • 33
50
votes
5 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
  • 43,016
  • 36
  • 114
  • 168
50
votes
7 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,164
  • 3
  • 24
  • 28
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
43
votes
3 answers

check if .one() is empty sqlAlchemy

I am running a query based off of other ids for the query. The problem i have is that sometimes the query won't find a result. Instead of having the entire program crash, how can I check to see if the result will be None? This is the query I…
john
  • 3,099
  • 6
  • 26
  • 50
42
votes
1 answer

Using alias() for 'select as' in SQLAlchemy

Let's say I have a table 'shares' with the following columns: company price quantity Microsoft 100 10 Google 99 5 Google 99 20 Google 101 15 I'd like to run the equivalent of a SQL statement like…
Vishakh
  • 896
  • 1
  • 9
  • 20
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
  • 5,370
  • 7
  • 39
  • 80
42
votes
4 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
  • 2,773
  • 7
  • 27
  • 30
39
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
  • 9,037
  • 9
  • 47
  • 83
34
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
  • 6,005
  • 8
  • 34
  • 56
33
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,099
  • 6
  • 26
  • 50
25
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
  • 7,690
  • 5
  • 40
  • 46
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
24
votes
1 answer

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,099
  • 6
  • 26
  • 50
24
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,103
  • 1
  • 10
  • 24
1
2 3
99 100