[gdal-dev] How to append data into an existing database table
Jeremy Palmer
JPalmer at linz.govt.nz
Mon Jan 9 19:50:23 EST 2012
Ah ok. I was hoping to avoid that.
> -----Original Message-----
> From: Even Rouault [mailto:even.rouault at mines-paris.org]
> Sent: Tuesday, 10 January 2012 1:49 p.m.
> To: Jeremy Palmer
> Cc: gdal-dev at lists.osgeo.org
> Subject: Re: [gdal-dev] How to append data into an existing database table
>
> Le mardi 10 janvier 2012 01:43:40, Jeremy Palmer a écrit :
> > I knew I was missing something!
> >
> > I've now noticed that empty fields within the CSV get populated as a
> > literal '' rather than null. Is there any option to control this behavior
> > as well?
>
> Not that I'm aware of.
>
> You can perhaps just issue a "UPDATE test_1 SET yourcolumn = NULL WHERE
> yourcolumn = ''" as a post-processing step ?
>
> >
> > Thanks again,
> > Jeremy
> >
> > > -----Original Message-----
> > > From: Even Rouault [mailto:even.rouault at mines-paris.org]
> > > Sent: Tuesday, 10 January 2012 11:24 a.m.
> > > To: gdal-dev at lists.osgeo.org
> > > Cc: Jeremy Palmer
> > > Subject: Re: [gdal-dev] How to append data into an existing database
> > > table
> > >
> > > Le lundi 09 janvier 2012 22:47:21, Jeremy Palmer a écrit :
> > > > Hi All,
> > > >
> > > > I've got an existing spatial table in PostgreSQL with has an existing
> > > > primary key (non-serial) and shape column:
> > > >
> > > > CREATE TABLE test_1
> > > > (
> > > >
> > > > id integer NOT NULL,
> > > > appellation TEXT,
> > > > affected_surveys TEXT,
> > > > parcel_intent TEXT NOT NULL,
> > > > topology_type VARCHAR(100) NOT NULL,
> > > > statutory_actions TEXT,
> > > > land_district VARCHAR(100) NOT NULL,
> > > > titles TEXT,
> > > > survey_area numeric(20,4),
> > > > calc_area numeric(20,4) NOT NULL,
> > > > shape geometry,
> > > > PRIMARY KEY (id)
> > > >
> > > > );
> > > >
> > > > I'm trying to append data from a CSV file into a pg database but I'm
> > > > having problems:
> > > >
> > > > ogr2ogr -append -f PostgreSQL "PG:host=xxxx dbname=xxxx" test1.vrt -nln
> > > > test_1
> > >
> > > Try adding the -preserve_fid option of ogr2ogr.
> >
> >
> #####################################################
> ######################
> > ##########
> >
> > This message contains information, which is confidential and may be subject
> > to legal privilege. If you are not the intended recipient, you must not
> > peruse, use, disseminate, distribute or copy this message. If you have
> > received this message in error, please notify us immediately (Phone 0800
> > 665 463 or info at linz.govt.nz) and destroy the original message. LINZ
> > accepts no responsibility for changes to this email, or for any
> > attachments, after its transmission from LINZ.
> >
> > Thank You.
> >
> >
> #####################################################
> ######################
> > ##########
#####################################################################################
This message contains information, which is confidential and may be subject to legal privilege.
If you are not the intended recipient, you must not peruse, use, disseminate, distribute or copy this message.
If you have received this message in error, please notify us immediately (Phone 0800 665 463 or info at linz.govt.nz) and destroy the original message.
LINZ accepts no responsibility for changes to this email, or for any attachments, after its transmission from LINZ.
Thank You.
#####################################################################################
More information about the gdal-dev
mailing list