-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove external integrations from collection integrations (PP-503) #1494
Remove external integrations from collection integrations (PP-503) #1494
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1494 +/- ##
==========================================
- Coverage 90.40% 90.39% -0.01%
==========================================
Files 233 233
Lines 29371 29157 -214
Branches 6860 6799 -61
==========================================
- Hits 26552 26357 -195
+ Misses 1796 1783 -13
+ Partials 1023 1017 -6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
c8f6854
to
cadf562
Compare
c9817fe
to
2a439b9
Compare
2a439b9
to
eafb469
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This took a while 😅
I mostly had comments about the migration, most of the rest seemed A-OK 👌
|
||
log = logging.getLogger(f"palace.migration.{revision}") | ||
log.setLevel(logging.INFO) | ||
log.disabled = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe these 3 lines can be a util method like get_migration_logger(revision)
alembic/versions/20231101_2d72d6876c52_remove_collection_external_integration.py
Show resolved
Hide resolved
# value, then make it non-nullable. | ||
op.add_column( | ||
"integration_configurations", | ||
sa.Column("context", postgresql.JSONB(astext_type=sa.Text()), nullable=True), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not set nullable=False
with default='{}'
here rather than later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that you can use default
with a new column in a table that has existing data.
When I try that the migration fails for me with:
E sqlalchemy.exc.IntegrityError: (psycopg2.errors.NotNullViolation) column "context" contains null values
E
E [SQL: ALTER TABLE integration_configurations ADD COLUMN context JSONB NOT NULL]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok, yes default
is an application level default. Using server_default
will work, I tested it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this changes the DB level schema though, right?
So migrated tables would have a different schema definition then tables that weren't migrated. We could mitigate this by changing the column definition to use server_default
, but since none of our other tables with defaults use server_default
, I'd rather leave it as default
for consistency.
api/odl.py
Outdated
@@ -78,7 +78,7 @@ class ODLAPIConstants: | |||
|
|||
|
|||
class ODLSettings(OPDSImporterSettings): | |||
external_account_id: Optional[HttpUrl] = FormField( | |||
external_account_id: HttpUrl = FormField( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we are using pydantic for this attribute (and not ignoring it anymore in favour of the collection.external_account_id) this is causing problems for me locally since some of my feeds are http://localhost
and HttpUrl
has require_tld=True
. This can go away with me changing my local settings, but it's something all the developers will need to be aware of.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm that's a good point... I maybe I'll change this one to AnyHttpUrl
, so its a bit less strict.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated this one.
@@ -37,7 +37,7 @@ | |||
from core.model.patron import Hold, Loan, Patron | |||
|
|||
|
|||
class ODL2Settings(OPDS2ImporterSettings, ODLSettings): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume the side effect of this making username and password mandatory was on purpose
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RishiDiwanTT I think I've got all the code review feedback resolved here. Pinging you for another review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
Clean up leftover columns from #1494, now that it has gone into a release.
Description
This PR changes the data model for our collections in a number of ways with the goal of removing all reliance on external integrations from our collections.
All the database columns and tables "removed" by this PR have just been renamed on the Python side, but left in place for now. Once this goes into a release #1498 can be merged to remove the now unused tables and columns.
The major changes:
external_integration_id
column has been removed.name
column.collections_libraries
table has been removed.collections_libraries
table, and via theirintegration_library_configuration
. This situation was confusing, and meant that these could get out of sync.external_account_id
column. This was duplicated between the table and thesettings
before, it now lives only in thesettings
. As with the others the column is still present, but is renamed and unused and will be dropped once this is rolled out everywhere.settings
column get a gin index, to make it easier to query the jsonb column.pyproject.toml
.Motivation and Context
Remove external integrations from collections PP-503.
How Has This Been Tested?
Checklist