Skip to content
Advertisement

Tag: postgresql

How to find pg_config path

Complete newbie here, trying to set up Django to work with PostgreSQL. I’m using mac osx 10.6.8. I have also installed PostgreSQL 9.3 When I run pip install psycopg2 in terminal I get the following error I’ve seen a number of posts on this how-to-install-psycopg2-with-pip-on-python pg-config-executable-not-found but I have no clue how to find the bin folder location containing pg_config.

PostgreSQL ILIKE query with SQLAlchemy

I’d like to run a query that selects all posts, case insensitive, that have titles that match ‘%’ + [some_phrase] + ‘%’. That is, select all rows that have titles that contain some phrase, case insensitive. From the research I’ve done, it looks like I need to use Postgres’s ILIKE query for it to match case insensitive. How can I

Get psycopg2 count(*) number of results

Whats the correct way to get the number or rows returned by this query? I’m specifically looking to see if no results are returned. Thanks. Answer results is itself a row object, in your case (judging by the claimed print output), a dictionary (you probably configured a dict-like cursor subclass); simply access the count key: Because you used .fetchone() only

Altering an Enum field using Alembic

How can I add an element to an Enum field in an alembic migration when using a version of PostgreSQL older than 9.1 (which adds the ALTER TYPE for enums)? This SO question explains the direct process, but I’m not quite sure how best to translate that using alembic. This is what I have: The above unfortunately only produces ALTER

Install psycopg2 on Ubuntu

I’m trying to get the python postgres client module installed on Ubuntu 12.04. The guidance is to do the following: However, apt says that the package can’t be located. I’m keen to install this through apt. Is this part of another package that I can install? Answer Using Ubuntu 12.04 it appears to work fine for me: What error are

Advertisement