dimitri / pgloader

Migrate to PostgreSQL in a single command!
http://pgloader.io
Other
5.45k stars 548 forks source link

MSSQL Materialize view is downloading all views instead of filtering & downloading only the ones passed in config. #1551

Open harshagarwal001 opened 11 months ago

harshagarwal001 commented 11 months ago

PGLOADER FILE FROM MS SQL TO Postgres


load database
     from mssql://USER_NAM@SOME_IP/db
     into postgresql:///db

CAST type nvarchar to text drop typemod using remove-null-characters,
      type varchar to text drop typemod using remove-null-characters

MATERIALIZE VIEWS view1
including only table names like 'tb1' in schema 'dbo'

set work_mem to '4GB', maintenance_work_mem to '4GB'

before load do $$ drop schema if exists dbo cascade; $$,
 $$ CREATE EXTENSION IF NOT EXISTS "uuid-ossp" $$

ALTER schema 'dbo' rename to 'public';

Expected Output:

It should port only view: "view1" but it get all the views from MS SQL.

Debugging:

  I can see from query in 
  ```pgloader --debug ms.load```:
  that query is missing 
  "WHERE Clause"
  it should filter using " WHERE t.TABLE_NAME IN ('view1')"
  but it does not have this Clause
  hence it gets all the views...
conoremclaughlin commented 9 months ago

I've created a PR that addresses this:

https://github.com/dimitri/pgloader/pull/1559/files

Good luck to anyone making their migration from MSSQL to Postgres!

harshagarwalsol commented 9 months ago

Thank you!!!

rengler-noodle commented 3 months ago

Would love to see this PR get merged!