<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">A S57 file with only 6 feature object
classes? Normally there should be many more.<br>
<br>
I would add triggers to each table in the database for timestamps.<br>
Potential workflow:<br>
1 ogr for initial import into own schema<br>
2 Postgre script, reading all tables in the schema using the
information_schema info, to truncate and add triggers<br>
3 ogr for final import<br>
<br>
<br>
</div>
<blockquote
cite="mid:HE1PR03MB133855B909319FC33419F094CA490@HE1PR03MB1338.eurprd03.prod.outlook.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
<div style="color: rgb(0, 0, 0); font-family:
Calibri,Helvetica,sans-serif; font-size: 12pt;">
Even,</div>
<div style="color: rgb(0, 0, 0); font-family:
Calibri,Helvetica,sans-serif; font-size: 12pt;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family:
Calibri,Helvetica,sans-serif; font-size: 12pt;">
Appreciate the response.</div>
<div style="color: rgb(0, 0, 0); font-family:
Calibri,Helvetica,sans-serif; font-size: 12pt;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family:
Calibri,Helvetica,sans-serif; font-size: 12pt;">
Your example is interesting but there are a couple of issues.
Importing a random .000 file using ogr2ogr yields 6 tables in
the database. Which tables are created depend on the data and
are unknown to me prior to import, so it is difficult to
generate the SQL in advance. This approach does not scale very
well if data yields a number of tables.</div>
<div style="color: rgb(0, 0, 0); font-family:
Calibri,Helvetica,sans-serif; font-size: 12pt;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family:
Calibri,Helvetica,sans-serif; font-size: 12pt;">
Another issue was when adding the SQL statement for one specific
table caused the import to ignore the other 5 tables. Is this
the expect result or should all 6 table be imported?</div>
<div style="color: rgb(0, 0, 0); font-family:
Calibri,Helvetica,sans-serif; font-size: 12pt;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family:
Calibri,Helvetica,sans-serif; font-size: 12pt;">
Regards, Lars</div>
<div style="color: rgb(0, 0, 0); font-family:
Calibri,Helvetica,sans-serif; font-size: 12pt;">
<br>
</div>
<hr tabindex="-1" style="width: 98%; display: inline-block;">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size: 11pt;"
color="#000000" face="Calibri, sans-serif"><b>Fra:</b> Even
Rouault <a class="moz-txt-link-rfc2396E" href="mailto:even.rouault@spatialys.com"><even.rouault@spatialys.com></a><br>
<b>Sendt:</b> fredag 22. juni 2018 23.15<br>
<b>Til:</b> <a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<b>Kopi:</b> Lars<br>
<b>Emne:</b> Re: [gdal-dev] ogr2ogr adding metadata</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:
11pt;">
<div class="PlainText">On vendredi 22 juin 2018 09:41:02
CEST Lars wrote:<br>
> Hello folks,<br>
> <br>
> Using ogr2ogr (version 2.2.3) to import s57 into
PostgreSQL which works<br>
> great.<br>
> <br>
> What is the recommended approach for adding metadata
to all inserted data?<br>
> <br>
> Say I wanted to add current date to all inserted
data. Does ogr2ogr support<br>
> such operation? Tried using the "-mo" argument but it
did not make any<br>
> inpact (same result with argument as without).
Ideally I do not want the<br>
> client to be adding this information as a post insert
operation (if even<br>
> possible).<br>
<br>
Lars,<br>
<br>
-mo will work only with very few target drivers (I can
only think to <br>
GeoPackage actually). This is per-layer/per-table
metadata. There's perhaps <br>
the equivalent in PostgreSQL but this isn't implemented by
GDAL<br>
<br>
But you can add a column with the current timestamp for
example with<br>
<br>
ogr2ogr -update PG:xxxxxx poly.shp \<br>
-sql "SELECT *, CURRENT_TIMESTAMP FROM poly"
-dialect SQLITE<br>
<br>
Even<br>
<br>
-- <br>
Spatialys - Geospatial professional services<br>
<a moz-do-not-send="true" href="http://www.spatialys.com">http://www.spatialys.com</a><br>
</div>
</span></font></div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a></pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Hälsningar
Andreas Oxenstierna
T-Kartor Geospatial AB
mobile: +46 733 206831
mailto: <a class="moz-txt-link-abbreviated" href="mailto:ao@t-kartor.se">ao@t-kartor.se</a>
<a class="moz-txt-link-freetext" href="http://www.t-kartor.com">http://www.t-kartor.com</a></pre>
</body>
</html>