Load a SQL file using shell comand
Hello Everybody,
I write because I have a litle issue.
I tried to load a sql file using this sentences:
/opt/vertica/bin/vsql -f "/root/Desktop/Files/bienes.sql" -U user -w pass
Always show this messager but doesn´t load the data in the table:
OUTPUT
--------
1
(1 row)
OUTPUT
--------
1
(1 row)
I tried to insert 1 tuple manually using GUI: Dbeaver
INSERT INTO DW.bienes(x1,x2,x3,x4,x5,X,Y,x6) VALUES (12345,'blah','lala','lalaa',asdf,NULL,NULL,NULL);
and the data was load.
Please anybode can help me whit this ? in my file.sql I have more than 13mm of tuples and is imposible to load using gui.
Please help me.
Best Regards
0
Comments
Hi ,
Vsql do not set autocommit on be default
Add commit to your sql file (right after the insert command ) and you should be fine
I hope you will find it useful
Thanke
Thank you Eli_revach for you reply.
Can I set autocommit Vsql to default ? I have 13k of inserts.
If you know, please let me know.
Best regards
Just to put in my two cents !
Why would you use insert satements ?
Vertica is not build to deal with this types of statements in an optimized manner !
Transform your insert statements into a csv file i garantee you will get maybe 1000x better performance.
Example :
Make it CSV format: comma delimited:
The output should be a csv content:
To load the data with copy when you have all columns in the talbe in the csv files as well:
To load data by skipping column :
- lets say you have 12 col in your table and only provide 8 col in you csv file.
- put data into fillers then associate filers with the cols you wanna populate.
- good to remenber that columns that wont be populated need to have null enabled or a default value in their definition.
Hope this helps !
Use Vertica for what it is . Fast loading/ Fast Querying ! and leave the OLTP stuff to OLTP db server types
Adrian,
hank you for your help.
Best Regards!
Was this able to do the trick ? Job ?
Happy to help
Adrian,
How can I run this command:
Using VSQL ?
Please advices.
Run this command :
- just edit your ip dbname and password
I received the following error:
You need ot emmbed the file location in ' '
Eg:
- make sure dbadmin has rights to read from the file.
Now, I received the following error:
Please advice.
The file must be on one of the nodes.
Move the file into a direcotry where dbadmin has access , eg : /tmp
If so logged as root run the command below:
- then run again the copy cmd.
Problem continue...
Ok ?!
run this :
Note:
make sure you are connected to the vertica node where the ip is !! if you are so you can get rid of the ip address form the cmd striing.