Merge Two SDF Files

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Merge Two SDF Files

Crispin_at_Linknode
Hi,

I have two SDF files that have the same schema definition (though under different schema names).
What are the options and recommended experience in merging them into a single dataset?

 Thanks - Crispin
Reply | Threaded
Open this post in threaded view
|

Re: Merge Two SDF Files

zspitzer
load em into a database, merge using good old sql and then export again?

On Tue, Apr 17, 2012 at 11:43 PM, Crispin_at_Linknode
<[hidden email]> wrote:

> Hi,
>
> I have two SDF files that have the same schema definition (though under
> different schema names).
> What are the options and recommended experience in merging them into a
> single dataset?
>
>  Thanks - Crispin
>
> --
> View this message in context: http://osgeo-org.1560.n6.nabble.com/Merge-Two-SDF-Files-tp4890301p4890301.html
> Sent from the FDO Users mailing list archive at Nabble.com.
> _______________________________________________
> fdo-users mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/fdo-users



--
Zac Spitzer
Solution Architect / Director
Ennoble Consultancy Australia
http://www.ennoble.com.au
http://zacster.blogspot.com
+61 405 847 168
_______________________________________________
fdo-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fdo-users
Reply | Threaded
Open this post in threaded view
|

Re: Merge Two SDF Files

Crispin_at_Linknode
Here is the solution I used for the record:

 How to: Merge Two SDF Files
===========================


 Summary
=========

Export to a database, merge with SQL, export to SDF



 Actions
=========

1) Export to Database
  * Run FDOToolbox
  * Load the two SDF files (drag 'n' drop)
  * Navigate in the class in the schema
  * Select right-click 'Dump to SDF/SQLite' and select the SQLite option and a filename (for both SDF files to create two SQlite files)


2) Merge with SQL
  * Run your favourite SQLite editor with a SQL prompt such as "sqliteadmin"
  * Open your first SQLite file as the active database
  * Start a SQL prompt and run the following commands - EDIT TO TASTE!

attach 'C:\Temp\FileA.sqlite' as toMerge;

select count(*) from TableA;
select count(*) from toMerge. TableB;

insert into TableA ([FIELDS_BUT_NOT_AUTOID])  select [FIELDS_BUT_NOT_AUTOID] from toMerge.TableB;

select count(*) from TableA;
-- this check should be the sum of the previous two counts


3) Export to SDF
  * Run FDOToolbox
  * Load the new merged SQLite file (drag 'n' drop)
  * Navigate in the class in the schema
  * Select right-click 'Data Query' and click the 'Execute' button to query all (may take some time)
  * Validate 'Returned XXXX Results' message in status
  * Select 'Save' menu then 'SDF' and choose a SDF filename to export to