Re: Encountered an error

From: Shaan Repswal <shaun(dot)reapswaal(at)gmail(dot)com>
To: psycopg(at)postgresql(dot)org
Subject: Re: Encountered an error
Date: 2016-03-14 14:11:44
Message-ID: CALa+hESn+oDzp8mgayJQOAV1RJMkhESjerP6AkYK-_hR5Chi8A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

Hey guys I built the string in python and then passed it to the
cur.execute() function. This was so simple! It scares me to see that I
didn't get it the first time around. But anyway, thanks for laying to rest
my confusions. Thank you so much!

On Fri, Mar 11, 2016 at 3:33 AM, Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
wrote:

> On Fri, Mar 11, 2016 at 01:16:33AM +0530, Shaan Repswal wrote:
>
> > I am new to databases and am a novice to programming in general.
>
> Don't worry.
>
> > @Karsten - I know, I got the feeling that the design felt awry as well.
> The
> > database will be on the local machine. And the client side will have the
> > code to error check the column names being added and also if there
> already
> > is a column by this name or not.
>
> You can add a second table (pseudo code)
>
> inventory_detail
> pk serial primary key
> fk_inventory integer foreign key (inventory.pk)
> detail_name text
> detail_value text
>
> and then - instead of creating columns in table inventory -
> add rows to the inventory_detail table where .detail_name
> would hold what otherwise would be the column name of the new
> column in inventory and .detail_value the value you would
> have put into the new column in table inventory. The
> fk_inventory column would hold the primary key of the row in
> the inventory table this inventory_detail row belongs to.
>
> Just a suggestion.
>
> Karsten
> --
> GPG key ID E4071346 @ eu.pool.sks-keyservers.net
> E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346
>
>
> --
> Sent via psycopg mailing list (psycopg(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/psycopg
>

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message Shaan Repswal 2016-03-14 15:11:04 Re: Encountered an error
Previous Message Adrian Klaver 2016-03-13 03:26:55 Re: unable to connect to postgres db via psycopy