FAAImport - diggybell/piaware-tools GitHub Wiki
This utility can be used to create the SQL scripts required to create and update a copy of the FAA Registry database. This database is updated every business day and is available for download. The database can be retrieved from this address.
https://registry.faa.gov/database/ReleasableAircraft.zip
unzip ReleasableAircraft.zip
This utility can be run manually using the following commands
cd <path to piaware-tools>/utility
php faa-update.php <options>
php faa-import --truncate --import --directory=<path to faa data> --file=MASTER.txt > master.sql
mysql faa < master.sql
php faa-import --truncate --import --directory=<path to faa data> --file=MASTER.txt > mysql faa
Using the methods described above, you will need to populate the initial database using data from three of the files contained in the FAA registry download. These files are listed below.
- MASTER.txt
- This file contains the master N-Number registration data
- ACFTREF.txt
- This file contains the list of aircraft models
- ENGINE.txt
- This file contains the list of engine models
- --schema
- Generate SQL to define tables based on FAA source data
- REQUIRED the first time to create the database on your MySQL/MariaDB installation
- Generate SQL to define tables based on FAA source data
- --import
- Generate SQL to import from FAA source data
- --truncate
- Generate SQL to truncate the table (ignored with --schema)
- --directory=<dir>
- Directory containing FAA source data
- --file=<filename>
- The name of the file to import (case sensitive)
- --help
- Display this help
This utility should be integrated with CRON to provide a daily update of the FAA database. The following example will execute the script at 02:00 to update the Master, Aircraft Reference, and Engine tables.
# download the current faa database and extract files
30 1 * * * cd <path to faa data>; wget https://registry.faa.gov/database/ReleasableAircraft.zip; unzip -j ReleasableAircraft.zip
# import the master icao/n-number table
0 2 * * * cd <path to piaware-tools>/utility; php faa-import --truncate --import --directory=<path to faa data> --file=MASTER.txt > mysql faa
# import the aircraft reference data
0 2 * * * cd <path to piaware-tools>/utility; php faa-import --truncate --import --directory=<path to faa data> --file=ACFTREF.txt > mysql faa
# import the engine reference data
0 2 * * * cd <path to piaware-tools>/utility; php faa-import --truncate --import --directory=<path to faa data> --file=ENGINE.txt > mysql faa
- Replace <path to piaware-tools> with the base path where you installed PiAware Tools.
- Replace <path to faa data> with the path where you have stored the FAA Registration data