Running Standalone SQLAlchemy Scripts in Pyramid

From time to time there comes the need to run automated scripts managed by either Python or Cron. In a recent project I had to run a standalone script that checks records on a database at certain hours. So here’s what I came up with. Most of the script is based on this post by [...]

UUID Objects in Pylons with SQLAlchemy

Recently I had to generate and store uuid objects into a Postgres database, but to my surprise SQLAlchemy kept showing the following error: sqlalchemy.exc.ProgrammingError: (ProgrammingError) can’t adapt type ‘UUID’ So the solution was that I had to change my field type from varchar to uuid on my Postgres database, import the psycopg2 extras functions and [...]

Pylons and Facebook based Authorization with OAuth 2.0

Authorizing a user using Facebook OAuth 2.0 based login it’s pretty straighfoard. This is for the person who asked a question on stackoverflow.com I hope it helps. Add the apikey, appid and secret of my Facebook app to the development.ini file facebook.apikey = 42bc5a4051b274ede5cb73a6cd6fad56 facebook.secret = a355e66e8c0293390896a170f9d5r4c3 facebook.appid = 20894420580890 Configure my model/init.py file: from [...]

repoze.what with reflected tables using SQLAlchemy in Pylons

One of the many things I like about SQLAlchemy is the feature of reflected tables, this means I can develop dashboards for existing applications with my current favorite framework(Pylons). So I had to create an authorization mechanism for my dashboard and this recipeĀ from the Pylons cookbook was just what I needed. The only thing I [...]