Support referring foreign keys from other schemas#58
Support referring foreign keys from other schemas#58Bouallegui-Moudhaffer wants to merge 2 commits intokraken-tech:mainfrom
Conversation
|
Hi @Bouallegui-Moudhaffer, thanks for your contribution. I will have a look at when I'm available next week. |
Thanks for the note @marcelofern. I’m genuinely interested in Kraken and potentially joining in the future, so I wanted to get more familiar with the tech you’re building. I’ve been going through Kraken Tech and OctoEnergy’s public repositories, especially around data engineering topics. As I was reviewing this repo, I spotted an area where I felt I could contribute something useful, so I took the opportunity to work on it. Thanks again for the feedback, I really appreciate it. |
Summary
This PR adds support for repacking tables that have referring foreign keys from other schemas.
Psycopack already tracked referring FK schema metadata, but it still rejected cross-schema referring FKs in
pre_validate()and assumed FK-related DDL would always run againstself.schema. This PR removes that limitation and makes FK handling schema-aware throughout the repack lifecycle.Changes
pre_validate()get_referring_fks()to resolve referred tables against the correct schema and check ownership against the actual referring table schemaTests
DIRECT_TRIGGERandCHANGE_LOGValidation
Ran locally:
pytest tests/test_repack.pyruff check .mypy .All passed.