question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong auto-detection of relationships between tables/excludeDependencies doesn't work

See original GitHub issue

I use obevo-db v7.2.0. There are 2 sqls which should generate DB tables: Account & WhitelistedAddress. Account.sql

//// CHANGE name=init_account
create table ACCOUNT
(
    CLIENT_ID           bigint    not null,
    WHITELISTED_ADDRESS varchar(64),
    COMP_ID             varchar(64),
    BEGIN_STRING        varchar(20),
    SUB_COMP_ID         varchar(64),
    LOCATION_ID         varchar(64),
    SYS_AUTH_ID         varchar(128),
    SYS_AUTH_SALT       varchar(64),
    SYS_AUTH_PWD        varchar(1024),
    CLIENT_TYPE int2,
    SYS_STAT int2,
    FROM_Z              timestamp not null,
    THRU_Z              timestamp not null,
    IN_Z                timestamp not null,
    OUT_Z               timestamp not null
);
GO

//// CHANGE name=add_pk
alter table ACCOUNT
    add constraint ACCOUNT_PK primary key (CLIENT_ID);
GO

//// CHANGE name=add_unq_client_id
alter table ACCOUNT ADD CONSTRAINT UNQ_CLIENT_ID UNIQUE (CLIENT_ID);
GO

//// CHANGE name=drop_whitelisted_address_column 
alter table ACCOUNT DROP COLUMN WHITELISTED_ADDRESS;
GO

Whitelisted_address.sql

//// CHANGE name=init_whitelisted_address
create table WHITELISTED_ADDRESS
(
    WHITELISTED_ADDRESS varchar(255) not null,
    CLIENT_ID           bigint
);
GO

//// CHANGE name=add_wl_pk
alter table WHITELISTED_ADDRESS add constraint WHITELISTED_ADDRESS_PK primary key (WHITELISTED_ADDRESS);
GO


//// CHANGE name=add_wl_fk
alter table WHITELISTED_ADDRESS add constraint WHITELISTED_ADDRESS_fk_0 foreign key (CLIENT_ID) references ACCOUNT(CLIENT_ID);
GO

//// CHANGE name=init_whitelisted_address_idx
create index WHITELISTED_ADDRESS_IDX0 on WHITELISTED_ADDRESS (CLIENT_ID);
GO

When I try to run deployment of DB by above scripts I got following issue:

com.gs.obevo.impl.graph.GraphCycleException: Found cycles for the changes below. Please correct the object content.
You can remediate by:
    A) manually excluding false dependencies using //// METADATA excludeDependencies=A,B,C or
    B) defining appropriate dependencies using the METADATA includeDependencies or dependencies attributes
It is helpful to analyze the EXPLICIT dependency types.

Changes are marked as [objectName.changeName]
Dependency Types: EXPLICIT = marked in code, IMPLICIT = from implied deploy order within incremental table changes

Cycle #1:
    [ACCOUNT.init_account]
    => [ACCOUNT.add_pk] (IMPLICIT)
    => [ACCOUNT.add_unq_client_id] (IMPLICIT)
    => [ACCOUNT.drop_whitelisted_address_column] (IMPLICIT)
    => [WHITELISTED_ADDRESS.add_wl_fk] (DISCOVERED)
    => [WHITELISTED_ADDRESS.init_whitelisted_address_idx] (IMPLICIT)
    => [ACCOUNT.init_account] (DISCOVERED) (CYCLE FORMED)

As you can see => [WHITELISTED_ADDRESS.add_wl_fk] (DISCOVERED) such auto-detected relationship was wrong, because all what I want is just remove WHITELISTED_ADDRESS column from Account table. This wrong auto-detection is first part of problem. Second part of problem that excludeDependencies doesn’t help me to resolve issue. I tried following change:

//// CHANGE name=drop_whitelisted_address_column excludeDependencies=WHITELISTED_ADDRESS
alter table ACCOUNT DROP COLUMN WHITELISTED_ADDRESS;

but it doesn’t have any effect. Obevo still resolves such statement as link to WHITELISTED_ADDRESS table.

What is the right way to use excludeDependencies?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
shantstepaniancommented, Oct 21, 2019

Great to hear!

I’ll leave this ticket open to track the work to clarify the cycle error message

1reaction
shantstepaniancommented, Oct 21, 2019

Hi, I was able to reproduce the issue using your example provided and found the issue

Please ignore my previous diagnosis; the case-sensitivity is not an issue. You can leave the file case upper-case as is

You have an implicit dependency in your init_account statement as well that you would need to exclude

//// CHANGE name=init_account
create table ACCOUNT
(
    CLIENT_ID           bigint    not null,
    WHITELISTED_ADDRESS varchar(64),

The cycle error message comes out a bit differently - the key line is the third line “[ACCOUNT.init_account] (DISCOVERED)”. DISCOVERED and EXPLICIT dependencies are the important ones to look at. (as an aside - the error message omits the DISCOVERED dependency type and only EXPLICIT; I will correct this)

Cycle #1:
    [WHITELISTED_ADDRESS.add_wl_fk]
    => [WHITELISTED_ADDRESS.init_whitelisted_address_idx] (IMPLICIT)
    => [ACCOUNT.init_account] (DISCOVERED)
    => [ACCOUNT.add_pk] (IMPLICIT)
    => [ACCOUNT.add_unq_client_id] (IMPLICIT)
    => [ACCOUNT.drop_whitelisted_address_column] (IMPLICIT)
    => [WHITELISTED_ADDRESS.add_wl_fk] (DISCOVERED) (CYCLE FORMED)

You can add the excludeDependencies to both the CHANGE entries in that file to fix it

//// CHANGE name=init_account excludeDependencies=WHITELISTED_ADDRESS
create table ACCOUNT
(
    CLIENT_ID           bigint    not null,
    WHITELISTED_ADDRESS varchar(64),

Let me know if that works for you

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - Gradle Transitive dependency exclusion is not working ...
It seems a dependency will not be excluded if there is another dependency somewhere that points to that same dependency without any of...
Read more >
Spring Boot, Maven and Eclipse Errors and TroubleShooting ...
Error : Hal Browser and Spring Boot Actuator are not working ... Maven exclusion is an awesome feature to exclude dependencies that we...
Read more >
Delete relationships between tables in a Data Model
Any additional relationships between a pair of tables are considered inactive. You can delete existing relationships between tables if you're sure they are...
Read more >
The Django admin site
If you need to provide a more process-centric interface that abstracts away the implementation details of database tables and fields, then it's probably...
Read more >
IO tools (text, CSV, HDF5, …) — pandas 1.5.2 documentation
To ensure no mixed types either set False , or specify the type with the dtype parameter. Note that the entire file is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found