Problem with dap 1.0.0 schema synchronization

Jump to solution
Community Champion

Hi --

I'm having trouble getting dap syncdb to work in a reliable/predictable manner w/r/t the application of upstream table schema changes to my local database. For some reason it seems to be trying to execute ALTER TABLE statements every time, even though the table schemas are up to date as far as I can tell.

This is especially problematic for my setup because i have a number of views that are based on the CD2 tables; since postgres does not allow table alteration if there are dependent views, I have to drop them before altering the table and restore them afterwards.  

For example, I'm trying to use dap syncdb to synchronize the assignments table. According to the instructure_dap.table_sync table, I have version 2 of the assignments table schema. This matches the version that I get from the dap schema command. I assume that this means that my local table's schema is up to date, and no ALTER TABLE statements are necessary. However, when I try to dap syncdb this table, it's trying to execute this:

ALTER TABLE "canvas"."assignments"
ALTER COLUMN "submission_types" SET DATA TYPE "canvas"."assignments__submission_types" ARRAY;

But this alteration is unnecessary -- the assignment.submission_types column already has the above data type. 

How do I get the dap library to stop trying to execute these unnecessary ALTER TABLE statements? The documentation is thin on how schema synchronization works, but it sounds to me like it should only be altering if there is a mismatch between the source and the target. Am I misunderstanding something here?

Thanks --


1 Solution

The phantom change issue you reported has been fixed on the dev branch of the open-source library pysqlsync. Until this is included in the official DAP client library distribution, you can pull the latest version and install it locally with

pip3 install --upgrade git+


View solution in original post