pylons

sqlalchemy existing database query

sqlalchemy existing database query Question: 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 this existing database? I have …

Total answers: 5

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

How to get column names from SQLAlchemy result (declarative syntax) Question: 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 = DBSession() row_data = session.query(Projects).filter_by(id=1).one() How can I get the …

Total answers: 8

get path of python binary that's executing the script

get path of python binary that's executing the script Question: I have a Pylons controller (irrelevant but explains why I have this need) say starter.py that starts another process using: retcode = subprocess.call((‘python’,’/path/to/myScript.py’)) now since the app runs in a virtual env python is not the right binary to call since it has no access …

Total answers: 1

SQLAlchemy, clear database content but don't drop the schema

SQLAlchemy, clear database content but don't drop the schema Question: I’m developing a Pylons app which is based on exisitng database, so I’m using reflection. I have an SQL file with the schema that I used to create my test database. That’s why I can’t simply use drop_all and create_all. I would like to write …

Total answers: 3

Should I use Pylons or Pyramid?

Should I use Pylons or Pyramid? Question: 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 Pyramid. Asked By: …

Total answers: 3

How to efficiently manage frequent schema changes using sqlalchemy?

How to efficiently manage frequent schema changes using sqlalchemy? Question: I’m programming a web application using sqlalchemy. Everything was smooth during the first phase of development when the site was not in production. I could easily change the database schema by simply deleting the old sqlite database and creating a new one from scratch. Now …

Total answers: 4

UnicodeEncodeError: 'latin-1' codec can't encode character

UnicodeEncodeError: 'latin-1' codec can't encode character Question: What could be causing this error when I try to insert a foreign character into the database? >>UnicodeEncodeError: ‘latin-1′ codec can’t encode character u’u201c’ in position 0: ordinal not in range(256) And how do I resolve it? Thanks! Asked By: ensnare || Source Answers: You are trying to …

Total answers: 12

Is there a python implementation to .net automapper?

Is there a python implementation to .net automapper? Question: Automapper is a object-object mapper where we can use to project domain model to view model in asp.net mvc. http://automapper.codeplex.com/ Is there equivalent implementation in Python for use in Django(Template)/Pylons ? Or is there necessity for this in Python world? Asked By: stoto || Source Answers: …

Total answers: 4

SQLAlchemy printing raw SQL from create()

SQLAlchemy printing raw SQL from create() Question: I am giving Pylons a try with SQLAlchemy, and I love it, there is just one thing, is it possible to print out the raw SQL CREATE TABLE data generated from Table().create() before it’s executed? Asked By: Mads Madsen || Source Answers: Something like this? (from the SQLA …

Total answers: 6

Which is faster, python webpages or php webpages?

Which is faster, python webpages or php webpages? Question: Which is faster, python webpages or php webpages? Does anyone know how the speed of pylons(or any of the other frameworks) compares to a similar website made with php? I know that serving a python base webpage via cgi is slower than php because of its …

Total answers: 10