Quantcast
Channel: Data Warehousing (DWH) Wiki » CSV
Viewing all articles
Browse latest Browse all 5

Export All Tables of a PostgreSQL Database

$
0
0

Data warehouse projects often lack the amount of historical data. To support these kind of projects, a database export of your PostgreSQL databases to flat files on a regular basis is required. EMS Data Export for PostgreSQL supports the easy extraction of PostgreSQL databases. The tool is part of EMS SQL Management Studio for PostgreSQL.

EMS Data Export for PostgreSQL is a powerful program to export your data quickly from PostgreSQL databases to any of 19 available formats, including MS Access, MS Excel, MS Word (RTF), HTML, XML, PDF, TXT, CSV, DBF, ODF and others. Data Export for PostgreSQL includes a wizard, which allows you to set export options for each table visually (destination filename, exported fields, data formats, and much more) and a command line utility to export data from tables and queries in one-touch.

This article guides you trough the process of exporting your PostgreSQL database to flat files which can be processed by other systems, for example in data warehouse projects.

Welcome to Data Export for PostgreSQL

This is the first screen shown to you when running the data export wizard:

Click the Next button to continue.

Set PostgreSQL Server Connection Options

The first step while exporting your PostgreSQL databases is to select the database server:

You have the following options for using tunnelling to connect to the PostgreSQL instance:

  • A direct connection which requires the PostgreSQL server to listen to the given TCP port (usually 5432)
  • A secure shell (SSH) tunnel
  • A HTTP tunnel (by providing the PHP script on your server)

Select the Next button to continue.

Select Database and Tables for Data Export

Select the database and tables to be exported in the next screen:

In addition, you have to provide the output directory. When done, select Next to continue.

Create Queries for Data Export

If you need to provide custom flat files (for example normalized tables), you can use the following dialog to configure any custom queries:

Select Next to continue after adding all your required queries.

Specify Output Data Format to Export

The next dialog allows you to select the output format of your data export. For data warehouse projects, one of the best formats is actually the comma separated file (CSV). It is easy to handle in ETL tools. For that reason, select the CSV option along with Apply to all exported objects:

The following output formats are available:

For data warehousing projects, the best practice is to use CSV files because ETL tools can easily handle them.

Select Next to go to the next dialog.

Select Fields to Export and Set Order of Exported Fields

Now its time to select the fields to be exported. In most cases, just select the Export all fields of all tables option:

Select Next to continue.

Set Export Options for the Selected Objects

For each output format, you can specify several options. The dialog below shows the options for CSV files:

Make sure to Quote Strings and have no header or footer.

Set Base Formats of Data Types

In addition to the basic settings in the previous dialog, you can also define the formatting of common data types:

As a general recommendation, you should keep the default settings and select Next to continue.

Set Export Final Options

Finally, you can select how many records should be exported:

For best support of data warehousing projects, select the Export all records option.

Select Next to continue.

Export Log

When hitting Export in the last dialog, the following log is generated:

If you want to schedule the export, use the Tools / Save Template menu item (next to the help button on the bottom left of the screen) to save the settings. You can use the command line tool for scheduling the export using the Windows Scheduler.

The following dialog is shown to present the progress of the data export:

For buying this tool, check out the EMS web site for the product. You should also check out EMS SQL Management Studio for PostgreSQL if you’re frequently working with PostgreSQL databases, for example for developing or other tasks, such as importing data or documenting databases.

Also, you might have noticed that the screen shots have been taken unter Linux (Gnome in this case). As a Windows application, the vendor is not officially supporting it with CrossOver Linux, but experiences have been very positive so far (matter of fact: no errors experienced).

If you like this how to document or have an idea for improvement, please leave a comment below.


Viewing all articles
Browse latest Browse all 5

Trending Articles