@@ -90,6 +90,48 @@ hxl2tab https://docs.google.com/spreadsheets/d/1Vqv6-EAdSHMSZvZtE426aXkDiwP8Mdrp
9090hxlquickimporttab temp/titanic.tab | head
9191
9292
93+ # ### [meta issue] HXL and data directly from and to SQL databases #10 __________
94+ # @see https://docs.sqlalchemy.org/en/13/dialects/
95+ # @see https://github.com/wireservice/csvkit/blob/master/csvkit/utilities/csvsql.py
96+
97+ # Generate create schema
98+ csvsql tests/files/iris_hxlated-csv.csv --dialect postgresql --skip-lines 1
99+ csvsql tests/files/iris_hxlated-csv.csv --dialect mysql --skip-lines 1
100+ # CREATE TABLE "iris_hxlated-csv" (
101+ # "#item+eng_sepal+eng_length+number" DECIMAL NOT NULL,
102+ # "#item+eng_sepal+eng_width+number" DECIMAL NOT NULL,
103+ # "#item+eng_petal+eng_length+number" DECIMAL NOT NULL,
104+ # "#item+eng_petal+eng_width+number" DECIMAL NOT NULL,
105+ # "#item+class+vt_class" VARCHAR NOT NULL
106+ # );
107+ csvsql tests/files/iris_hxlated-csv.csv --dialect mysql --skip-lines 1
108+ # CREATE TABLE `iris_hxlated-csv` (
109+ # `#item+eng_sepal+eng_length+number` DECIMAL(38, 1) NOT NULL,
110+ # `#item+eng_sepal+eng_width+number` DECIMAL(38, 1) NOT NULL,
111+ # `#item+eng_petal+eng_length+number` DECIMAL(38, 1) NOT NULL,
112+ # `#item+eng_petal+eng_width+number` DECIMAL(38, 1) NOT NULL,
113+ # `#item+class+vt_class` VARCHAR(15) NOT NULL
114+ # );
115+ csvsql tests/files/iris_hxlated-csv.csv --dialect sqlite --skip-lines 1
116+ # CREATE TABLE "iris_hxlated-csv" (
117+ # "#item+eng_sepal+eng_length+number" FLOAT NOT NULL,
118+ # "#item+eng_sepal+eng_width+number" FLOAT NOT NULL,
119+ # "#item+eng_petal+eng_length+number" FLOAT NOT NULL,
120+ # "#item+eng_petal+eng_width+number" FLOAT NOT NULL,
121+ # "#item+class+vt_class" VARCHAR NOT NULL
122+ # );
123+ csvsql tests/files/iris_hxlated-csv.csv --dialect mssql --skip-lines 1
124+ # CREATE TABLE [iris_hxlated-csv] (
125+ # [#item+eng_sepal+eng_length+number] DECIMAL(38, 1) NOT NULL,
126+ # [#item+eng_sepal+eng_width+number] DECIMAL(38, 1) NOT NULL,
127+ # [#item+eng_petal+eng_length+number] DECIMAL(38, 1) NOT NULL,
128+ # [#item+eng_petal+eng_width+number] DECIMAL(38, 1) NOT NULL,
129+ # [#item+class+vt_class] VARCHAR(max) NOT NULL
130+ # );
131+
132+ # Insert data directly on the server
133+ csvsql tests/files/iris_hxlated-csv.csv --db ' postgresql://postgres:password@localhost/hxltest' --skip-lines 1
134+
93135# ### Ignore after this part ___________________________________________________
94136# fititnt@bravo:/workspace/data/brasil_inep_microdados-enem-2019/DADOS$ head -n 1000 MICRODADOS_ENEM_2019.csv > MICRODADOS_ENEM_2019_head-n-1000.csv
95137hxlquickimport hxlquickimport_samples/MICRODADOS_ENEM_2019_head-n-1000.csv | hxl2tab
0 commit comments