Add duplicate detection, date range and dry run

Skip transactions that already exist in Firefly III, matched by date,
description and amount. Add --start-date, --end-date and --dry-run,
process transactions day by day, and rename --test-limit to
--transactions-limit.
This commit is contained in:
snegov committed 2026-11-18 20:03:17 -07:00
1 parent 6920328ebc
commit 32040f33b9
2 files changed
+296 -102

No files matched your search

+35 -2
View File
@@ -8,6 +8,8 @@ This tool helps you migrate your financial data from GnuCash to Firefly III auto
- **Creates corresponding accounts in Firefly III** with proper hierarchical names and account types
- **Migrates transactions** between accounts with dates, amounts, and descriptions
- **Handles multiple currencies** by enabling them in Firefly III first
- **Duplicate detection** - automatically skips transactions that already exist in Firefly III
- **Batch processing** - processes transactions day by day for better organization
- **Provides safety features** like test limits and accounts-only migration
## What gets migrated
@@ -23,6 +25,8 @@ This tool helps you migrate your financial data from GnuCash to Firefly III auto
- Simple 2-split transactions with dates, amounts, descriptions
- Transaction memos/notes
- Multi-currency support
- **Duplicate detection** using date + description + amount matching
- **Batch processing** by date for efficient synchronization
- Complex split transactions are logged but skipped for manual review
## Requirements
@@ -90,13 +94,20 @@ python g2f.py \
- `--gnucash-db` - Path to your GnuCash SQLite database file (required)
- `--firefly-url` - Your Firefly III base URL (required)
- `--firefly-token` - API token (optional if using FIREFLY_TOKEN environment variable)
- `--test-limit` - Limit number of transactions for testing (optional)
- `--transactions-limit` - Limit number of transactions for testing (optional)
- `--accounts-only` - Only migrate accounts, skip transactions
- `--start-date` - Start date for transaction migration (YYYY-MM-DD)
- `--end-date` - End date for transaction migration (YYYY-MM-DD)
- `--dry-run` - Perform a dry run without making any changes
## Safety Features
- **Test limits**: Use `--test-limit` to migrate only a few transactions first
- **Test limits**: Use `--transactions-limit` to migrate only a few transactions first
- **Accounts-only mode**: Use `--accounts-only` to set up account structure first
- **Duplicate detection**: Automatically skips transactions that already exist
- **Date range filtering**: Use `--start-date` and `--end-date` to migrate specific time periods
- **Batch processing**: Transactions are processed day by day for better organization and logging
- **Dry run mode**: Use `--dry-run` to see what would be migrated without making changes
- **Detailed logging**: All actions are logged with timestamps
- **Error handling**: Failed operations are logged and don't stop the entire migration
- **Hierarchical account names**: Full GnuCash account paths preserve your organization
@@ -123,6 +134,28 @@ GnuCash's hierarchical account structure is preserved by using full account path
This maintains your account organization while working within Firefly III's flat account structure.
## Duplicate Detection
The tool now includes intelligent duplicate detection to prevent importing the same transactions multiple times:
- **Detection method**: Transactions are identified as duplicates using a combination of date + description + amount
- **Automatic skipping**: Duplicate transactions are automatically skipped during migration
- **Batch processing**: Transactions are processed day by day, making it easy to resume migrations or add new data
- **Multiple identical transactions**: If you have multiple identical transactions on the same day, they are counted and handled appropriately
### Usage examples:
```bash
# Basic migration with duplicate detection
python g2f.py --gnucash-db bank.gnucash --firefly-url http://localhost
# Import only transactions from a specific date range
python g2f.py --gnucash-db bank.gnucash --firefly-url http://localhost --start-date 2024-01-01 --end-date 2024-01-31
# Dry run to see what would be imported
python g2f.py --gnucash-db bank.gnucash --firefly-url http://localhost --dry-run
```
## Important Notes
- **Always backup your Firefly III data** before running a migration