Introduction
Introduction
A producer sends three audio clips to an editor. The intro has ID 0042 and the outro has ID 42. The delivery folder still has two separate files, but if the destination treats both IDs as numbers, a lookup for 42 can return either row. A row-count check will pass.
We imported and exported a fictional three-file inventory with SQLite 3.54.0. You can repeat the test in a temporary database before connecting a real asset library.
Run a three-file rehearsal
Save a UTF-8 file named input.csv in a temporary folder. Put asset_id,file on the first line. On the next three lines, enter the input pairs from the first two columns below, separated by commas. Keep the original CSV closed in a text editor or save a read-only copy before testing.
One local import and export per destination type, with the same fictional input each time.
| Input ID | Filename | TEXT export | INTEGER export |
|---|---|---|---|
| 0042 | intro.wav | 0042 | 42 |
| 42 | outro.wav | 42 | 42 |
| A042 | theme.wav | A042 | A042 |
Compare two destination fields
From that folder, start sqlite3 :memory: to open an empty temporary database. Enter each line below separately. The SQL statements end with a semicolon. The dot commands operate on the shell and take no semicolon.
CREATE TABLE assets(asset_id TEXT, file TEXT);
.import --csv --skip 1 input.csv assets
.headers on
.mode csv
SELECT asset_id,file FROM assets ORDER BY rowid;
Count keys and check the actual pairings
The query prints CSV to the terminal. With the TEXT column our export retained all three input pairs. To run the comparison, quit with .quit, open another empty in-memory database and repeat the same commands using INTEGER in place of TEXT for asset_id. The import still produced three rows, but it exported the IDs 42, 42 and A042.
The letter in A042 kept that value from converting to an integer in this ordinary SQLite table. Its survival alone would make a poor test. The revealing pair is 0042 and 42: count their distinct IDs and inspect which clip each one names.
Find the ID shared by two clips
Run these two queries separately in each rehearsal database before you release the lookup. The first counts inventory rows and distinct IDs. The second shows which IDs occur more than once.
In our three-file test, the INTEGER field has all three rows but only two distinct IDs. Treat the repeated 42 as a reason to stop. Even a 3/3 result cannot catch an intro and outro whose IDs were swapped. Compare the filename and ID pairs before handing the inventory to the editor.
SELECT COUNT(*) AS rows_seen, COUNT(DISTINCT asset_id) AS distinct_ids FROM assets;
SELECT asset_id, COUNT(*) AS uses FROM assets GROUP BY asset_id HAVING COUNT(*) > 1;
Results for the same three fictional clips in each destination.
| Destination field | Rows seen | Distinct IDs | Duplicate query result |
|---|---|---|---|
| TEXT | 3 | 3 | No rows |
| INTEGER | 3 | 2 | 42 appears twice |
Stop the handoff when two IDs collapse
If the destination already merged the keys, freeze the lookup before the next clip assignment. Reimport the untouched source into a text field, export it again and compare both columns by filename. Keep intro.wav paired with 0042 and outro.wav with 42.
For a different destination, run the same three rows through its actual importer and exporter. A spreadsheet display that adds zeros for appearance only tells you how a cell looks. Inspect the exported file as plain text to see what the next tool receives.
