SQLines Data - Database Migration from SQL Server to PostgreSQL

SQLine Data is a scalable, high performance data transfer, schema conversion and validation tool for Microsoft SQL Server to PostgreSQL migration.

The tool requires connections to SQL Server (SQL Server Native Client) and PostgreSQL (PostgreSQL C API libpq) databases. To convert SQL statements and scripts, use SQLines SQL Converter tool.

Why SQLines Data

SQLines Data benefits:

Migration Features

  • All Data Types
  • NOT NULL Constraints
  • DEFAULT Clauses
  • IDENTITY Columns
  • CHECK Constraints
  • Primary and Foreign Keys
  • Unique Constraints
  • Indexes
  • Comments on Tables and Columns
  • Schema Name Mapping

You can use SQLines SQL Converter tool to convert stored procedures, functions, triggers, views and other objects.

Advanced Data Transformation Features

  • Global and table level data type mapping
  • Table and schema mapping
  • Data filters (WHERE conditions)
  • Computed columns and expressions
  • Queries to define data to transfer
  • Various DDL and data options

Advanced Database Migration Features

Scalability and High-Performance

  • Transferring tables in multiple concurrent sessions
  • Performing concurrent read and write operations in each session
  • Using SQL Server Native Client Bulk Copy API to insert data to SQL Server
  • Using PostgreSQL libpq C API with COPY command to load data to PostgreSQL
  • Multi-threaded C/C++ Application
  • Linux and Windows

Designed for DBAs and Enterprise-Class Migrations

  • Easy to set up and configure the transfer of a large number of tables
  • Command line with powerful and easy to use options
  • Wildcards to select tables
  • Comprehensive performance stats to help you tune the data transfer
  • No space required to hold SQL Server export
  • No ADO.NET providers required
  • No .NET dependency
  • No installation required

Migration Validation

  • Comparing the number of rows in SQL Server and PostgreSQL tables
  • Comparing data values in all columns

Logging and Statistics

  • Comprehensive performance stats to help you tune the data transfer
  • Execution time for each DDL statement
  • Read and write performance for each table (rows/sec and bytes/sec)
  • Saving all executed DDL SQL statements into .sql file
  • Saving all failed DDL SQL statements into a separate .sql file
  • Summary performance information

SQLines Data in Command Line

You can use SQLines Data tool in command line. Just launch sqldata.exe on Windows or ./sqldata on Linux with the specified options.

For information how to set up and troubleshoot SQL Server and PostgreSQL connections, see SQLines Data Connection String Formats.

Examples:

  • Transfer a single table
sqldata -t=emp -sd=sql, trusted@localhost\sqlexpress,db_name -td=pg,usr/pwd@localhost,pg_dbname

-t option defines the table name, -sd and -td options (source and target databases) specify the connection strings for SQL Server and PostgreSQL, respectively.

This command transfers table emp from SQL Server database to PostgreSQL pg_dbname database.

For list of options, see Command Line Reference.

SQLines Data UI on Windows

You can use SQLines Data UI on Windows only. Just launch sqldataw.exe and follow the following steps.

  • Step 1 - Configure Connections

Select the source database Microsoft SQL Server, the target database PostgreSQL and specify the login information for both databases.

You can click Test Connection buttons to test your source and target database connections.

For information how to set up and troubleshoot SQL Server and PostgreSQL connections, see SQLines Data Connection String Formats.

  • Step 2 - Select Tables to Transfer

Select the tables to transfer. You can use wildcards like *, *.*, schema.* or list individual tables. Multiple comma-separated items can be specified.

  • Step 3 - Run Transfer

Click Transfer button to start the migration process.

  • Step 4 - Run Validation

Click Validate button to start the validation.

Important Note. Take into account that the evaluation version of the tool may skip 1 row from each table.

Advanced Data Transformation Features

SQLines Data tool offer many features to tranform data. For more details, see SQLines Data Overview.

Data Filters (WHERE Conditions)

You can use sqlines_twhere.txt file and specify an individual filter for any source table. If a filter is not specified for the table all its data are transferred.

For example:

  -- Syntax:
  -- source_table1, condition1;  (do not specify WHERE keyword, use ; to terminate the WHERE clause)
  -- source_table2, condition2; ... ;
 
  dbo.Documents, [create_dt] BETWEEN CAST('2024-07-17' AS DATE) AND CAST('2024-07-18' AS DATE);

For more details, see -twheref option.