I have a list of values as such:
row = ['0x14', '0xb6', '0xa1', '0x0', '0xa1', '0x0']
I would like to insert these into a bytea field in my PostgreSQL database, using psycopg2, but I am unfamiliar with byte strings in python.
What is the best way to achieve this?
...
I have a website that allows users with accounts. Account profiles are displayed on the front end of a website. Users can login and update their data, but it all must be approved by an admin (on a form) before the front end content reflects their update. The "live" data is stored across multiple tables in a Postgresql DB.
I'm looking...
I am quite new to the postgresql.
what is the best way to achieve this?
SELECT get_columns()
FROM table_name;
get_columns() will provide the column names for the query. I saw people advising to use EXECUTE statement but I couldn't got that working.
Lets say there is table Test with columns a,b,c
and I want to run
SELECT a,b FR...
I am switching from using SQLite3 to PostgreSQL, and hoped that I could populate the database using the fixtures I had been using to populate SQLite3. However, I am getting these errors:
$ python manage.py loaddata fixtures/core.json fixtures/auth.json
Installing json fixture 'fixtures/core' from absolute path.
Problem installing fixtu...
I want to write a cron job to calculate PosgreSql database size in python. Is there any API's in python. Cron job will find all the databases & calculate sizes for all of them daily.
...
Hello,
I was wondering if there were any good sources or documents that could explain to me how I can cannot to a PostgreSQL database from within my iPhone application.
Also, if they could go beyond just connecting, and explain how to use PL/SQL and Object Persistence within the Objective C iPhone SDK framework as well, that would be a...
Hello,
I have a database table that is growing too big (few hundred million rows) that needs to be optimized, but before I get into partitioning it, I thought I'd ask about suggestions.
Here is the usage:
0 . Table contains about 10 columns of length about 20 bytes each.
INSERTS are performed at a rate of hundreds of times per secon...
I'm working with code I'm converting to Pgsql working with .NET. I want to call a stored function that has several parameters, but I'd like to bind the parameters by name, like so:
NpgsqlCommand command = new NpgsqlCommand("\"StoredFunction\"", _Connection)
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add("para...
Hi I want to create the schema with the name assigned to the variable.
Example:
CREATE OR REPLACE FUNCTION test1("name" character varying)
RETURNS void AS
'CREATE SCHEMA "name";'
LANGUAGE 'sql' VOLATILE
COST 100;
ALTER FUNCTION test1(character varying) OWNER TO postgres;
...
I have the same question as #1895500, but with PostgreSQL not MySQL.
How can I define a view that has a calculated field, for example:
(mytable.col1 * 2) AS times_two
... and create another calculated field that's based on the first one:
(times_two * 2) AS times_four
...?
...
Is it possible to define an array of text fields (or any data type) and select a value from it, all within a single statement? For example:
SELECT ARRAY['First', 'Second', 'Third'][mytable.state] as interpreted_state WHERE mytable.id = 1;
...
I currently have a site which uses a MySQL 4.x schema, the site uses PHP for the backend. I'm currently in Django-land and I like Postgres so far ( meaning I'm a noob to both ).
What would be the easiest way to go about importing the data in my tables ( the dump file for the entire DB is around ~200 MB ) into my new project? I currently...
I'm looking for some type of profiling utility I could use where I can compare between 2 different setups with some sort of consistency factor. Would appreciate if anyone could point me in the right direction.
...
I'm wondering if it is possible, that after a collection of rows is inserted, to initiate an operation that is executed asynchronously, is non-blocking, and doesn't need to inform the originator of the request - of the result.
I am working with large amounts of events and I can guarantee that the post-insert logic will not fail -- I jus...
My application does not fit into the "general purpose" RDBMS schema category, I do not want a ginormous DDL script -- therefore I would need #include semantics and I will probably have different variants of the scripts therefore I would need #ifdef semantics. Is GNU m4 the way to go ?
Or perhaps there are some macro cabilities in psql ...
According to this page in the manual, indexes don't need to be maintained. However, we are running with a PostgresQL table that has a continuous rate of updates, deletes and inserts that over time (a few days) sees a significant query degradation. If we delete and recreate the index, query performance is restored.
We are using out of ...
Note: m4 is being used so "_" prefixed strings are expanded (m4 is a macro pre-processor similar to the c preprocessor).
My Type:
CREATE TYPE UrlPair AS (
HostName varchar( _LIMIT_HOSTNAME ),
ScriptName varchar( _LIMIT_SCRIPTNAME ) ...
In SQLServer, you can use syntax "(nolock)" to ensure the query doesn't lock the table or isn't blocked by other queries locking the same table.
e.g.
SELECT * FROM mytable (nolock) WHERE id = blah
What's the equivalent syntax in Postgres? I found some documentation on table locking in PG (http://www.postgresql.org/docs/8.1/interactive...
I find that it's pretty common most people hardcode the navigation into their templates, but I'm dealing with a pretty dynamic news site which might be better off if the primary nav was db driven.
So I was thinking of having a Navigation model where each row would be a link.
link_id INT primary key
link_name varchar(255)
url varchar(2...
In the django admin I inserted a row by specifying 2 columns ( firstName, lastName ) and the description column had blank=True set.
I then tried mimicing this with fixtures because I have to import data from a legacy sql dump but I can't seem to avoid filling in a value for description. What is django doing different? Does it specify a...