[Tutor] make a sqlite3 database from an ordinary text file
Alan Gauld
alan.gauld at yahoo.co.uk
Sun Jun 19 15:16:39 EDT 2022
On 19/06/2022 19:37, Manprit Singh wrote:
> How can i use column name in text file as colum names in sqlite3 database .
> I tried using python but failed.
I'm not sure if this is what you mean but....
sqlite> .help import
.import FILE TABLE Import data from FILE into TABLE
Options:
--ascii Use \037 and \036 as column and row separators
--csv Use , and \n as column and row separators
--skip N Skip the first N rows of input
-v "Verbose" - increase auxiliary output
Notes:
* If TABLE does not exist, it is created. The first row of input
determines the column names.
* If neither --csv or --ascii are used, the input mode is derived
from the ".mode" output mode
* If FILE begins with "|" then it is a command that generates the
input text.
sqlite>
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list