Loading Data Using the COPY Command

Learn how to load data using the COPY command.

Generally, how we load the data depends on the output of the extracted data. Let’s discuss some considerations when loading data into the destination repository.

The COPY command

The COPY command is an extremely useful command for loading data. It’s one of the most efficient ways to load files (from the local machine or a file storage repository like S3 or Google Bucket) to a database/data warehouse. The COPY command can be executed as a SQL query, a command line statement, or as a Python script, and it appends data to the existing data.

The COPY command is available on many database platforms, although, for some, it is called by a different name; for example, in MySQL, we load files of data by using LOAD FROM, and in BigQuery, we can load files using LOAD DATA instead of COPY. Read the database documentation before loading to check the loading mechanism the database vendor offers.

The general syntax for using the COPY command is this:

Get hands-on with 1400+ tech skills courses.