Loading data with LOAD CSV
LOAD CSV
can be used to load the data from the following:
- Local filesystem on a server: The files have to be in the
import
directory of the server.LOAD CSV
cannot access random locations. - From a URL: It is possible to load the data from any URL that is accessible from the server.
Note
Remember that LOAD CSV
is the command issued by the client to the server. If it is a URL, it should be accessible from the server, as the server will try to download the CSV content from the URL and process the next steps.
We will take a look at some LOAD CSV
usage examples in this section.
When the server processes the CSV file, each row is converted into a MAP
or LIST
type depending on how the command is issued.
LOAD CSV without headers
When we use the LOAD CSV
command without a header option, then each row is mapped as a list. The screenshot here shows how this would look:
Figure 3.2 – LOAD CSV from the browser...