1Loading dBase files with pgloader 2--------------------------------- 3 4The dBase format is still in use in some places as modern tools such as 5*Filemaker* and *Excel* offer some level of support for it. Speaking of 6support in modern tools, pgloader is right there on the list too! 7 8The Command 9^^^^^^^^^^^ 10 11To load data with pgloader you need to define in a *command* the operations in 12some details. Here's our example for loading a dBase file, using a file 13provided by the french administration. 14 15You can find more files from them at the `Insee 16<http://www.insee.fr/fr/methodes/nomenclatures/cog/telechargement.asp>`_ 17website. 18 19Here's our command:: 20 21 LOAD DBF 22 FROM http://www.insee.fr/fr/methodes/nomenclatures/cog/telechargement/2013/dbf/historiq2013.zip 23 INTO postgresql:///pgloader 24 WITH truncate, create table 25 SET client_encoding TO 'latin1'; 26 27Note that here pgloader will benefit from the meta-data information found in 28the dBase file to create a PostgreSQL table capable of hosting the data as 29described, then load the data. 30 31Loading the data 32^^^^^^^^^^^^^^^^ 33 34Let's start the `pgloader` command with our `dbf-zip.load` command file:: 35 36 $ pgloader dbf-zip.load 37 ... LOG Starting pgloader, log system is ready. 38 ... LOG Parsing commands from file "/Users/dim/dev/pgloader/test/dbf-zip.load" 39 ... LOG Fetching 'http://www.insee.fr/fr/methodes/nomenclatures/cog/telechargement/2013/dbf/historiq2013.zip' 40 ... LOG Extracting files from archive '//private/var/folders/w7/9n8v8pw54t1gngfff0lj16040000gn/T/pgloader//historiq2013.zip' 41 42 table name read imported errors time 43 ----------------- --------- --------- --------- -------------- 44 download 0 0 0 0.167s 45 extract 0 0 0 1.010s 46 create, truncate 0 0 0 0.071s 47 ----------------- --------- --------- --------- -------------- 48 historiq2013 9181 9181 0 0.658s 49 ----------------- --------- --------- --------- -------------- 50 Total import time 9181 9181 0 1.906s 51 52We can see that `pgloader <http://pgloader.io>`_ did download the file from 53its HTTP URL location then *unziped* it before the loading itself. 54 55Note that the output of the command has been edited to facilitate its 56browsing online. 57