···219219220220You can request an archive of your Twitter data by [following these instructions](https://help.twitter.com/en/managing-your-account/how-to-download-your-twitter-archive).
221221222222-Twitter will send you a link to download a `.zip` file. You can import the contents of that file into a set of tables (each beginning with the `archive-` prefix) using the `import` command:
222222+Twitter will send you a link to download a `.zip` file. You can import the contents of that file into a set of tables in a new database file called `archive.db` (each table beginning with the `archive-` prefix) using the `import` command:
223223224224 $ twitter-to-sqlite import archive.db ~/Downloads/twitter-2019-06-25-b31f2.zip
225225226226This command does not populate any of the regular tables, since Twitter's export data does not exactly match the schema returned by the Twitter API.
227227+228228+It will delete and recreate all of your `archive-*` tables every time you run it. If this is not what you want, run the command against a new SQLite database file name rather than running it against one that already exists.
227229228230You may want to use other commands to populate tables based on data from the archive. For example, to retrieve full API versions of each of the tweets you have favourited in your archive, you could run the following:
229231
···473473def import_(db_path, archive_path):
474474 "Import data from a Twitter exported archive"
475475 db = sqlite_utils.Database(db_path)
476476+ # Drop archive-* tables that already exist
477477+ for table in db.tables:
478478+ if table.name.startswith("archive-"):
479479+ table.drop()
476480 for filename, content in utils.read_archive_js(archive_path):
477481 filename = filename[: -len(".js")]
478482 if filename not in archive.transformers: