Skip to content

Remove backend repos#555

Merged
gadomski merged 8 commits intomainfrom
issues/432-split-backends
May 9, 2023
Merged

Remove backend repos#555
gadomski merged 8 commits intomainfrom
issues/432-split-backends

Conversation

@gadomski
Copy link
Copy Markdown
Member

@gadomski gadomski commented Apr 3, 2023

Related Issue(s):

Description:

No functional code changes. Removes the two backends, they live on their own now:

It'd be nice to have a in-memory backend that we could use to exercise the API w/o a database, but that's a pretty significant lift. Something for the future, perhaps.

This is such a major change to the infrastructure (not the code) that I'd like to get at least two approving reviews on it.

PR Checklist:

  • pre-commit hooks pass locally
  • Tests pass (run make test)
  • Documentation has been updated to reflect changes, if applicable, and docs build successfully (run make docs)
  • Changes are added to the CHANGELOG.
  • (once approved) Remove branch protections that reference the backends
@gadomski gadomski self-assigned this Apr 3, 2023
@gadomski gadomski changed the title feat: remove backend repos Apr 3, 2023
@gadomski gadomski force-pushed the issues/432-split-backends branch from 941a56d to 2b64a72 Compare April 3, 2023 21:35
@gadomski gadomski marked this pull request as ready for review April 3, 2023 21:38
@moradology
Copy link
Copy Markdown
Collaborator

moradology commented Apr 18, 2023

I'm noticing a few spots in which old references exist in the docs. Going to list them here in case we want them updated prior to merging:

docs/api/stac_fastapi/types/clients/sync_core.md
59:* stac_fastapi.sqlalchemy.core.CoreCrudClient

docs/api/stac_fastapi/types/clients/transaction.md
211:* stac_fastapi.sqlalchemy.transactions.TransactionsClient

docs/api/stac_fastapi/types/config.md
40:* stac_fastapi.sqlalchemy.config.SqlalchemySettings

docs/api/stac_fastapi/types/core.md
547:* stac_fastapi.sqlalchemy.core.CoreCrudClient
855:* stac_fastapi.sqlalchemy.transactions.TransactionsClient

docs/api/stac_fastapi/sqlalchemy/app.md
1:# Module stac_fastapi.sqlalchemy.app

docs/api/stac_fastapi/sqlalchemy/models/search.md
1:# Module stac_fastapi.sqlalchemy.models.search
3:Queryable data types for sqlalchemy backend.

docs/api/stac_fastapi/sqlalchemy/models/index.md
1:# Module stac_fastapi.sqlalchemy.models
9:* [stac_fastapi.sqlalchemy.models.database](database/)
10:* [stac_fastapi.sqlalchemy.models.search](search/)

docs/api/stac_fastapi/sqlalchemy/models/database.md
1:# Module stac_fastapi.sqlalchemy.models.database
3:SQLAlchemy ORM models.
19:* stac_fastapi.sqlalchemy.models.database.Collection
20:* stac_fastapi.sqlalchemy.models.database.Item
21:* stac_fastapi.sqlalchemy.models.database.PaginationToken
39:* stac_fastapi.sqlalchemy.models.database.Base
120:* sqlalchemy.sql.type_api.UserDefinedType
121:* sqlalchemy.sql.type_api.TypeEngine
122:* sqlalchemy.sql.visitors.Visitable
329:This function is currently not implemented for SQLAlchemy
335:A future release of SQLAlchemy will potentially implement this method
563:    from sqlalchemy.types import String
564:    from sqlalchemy.dialects import mysql
596:* stac_fastapi.sqlalchemy.models.database.Base
672:* stac_fastapi.sqlalchemy.models.database.Base

docs/api/stac_fastapi/sqlalchemy/extensions/query.md
1:# Module stac_fastapi.sqlalchemy.extensions.query
3:STAC SQLAlchemy specific query search model.

docs/api/stac_fastapi/sqlalchemy/extensions/index.md
1:# Module stac_fastapi.sqlalchemy.extensions
3:sqlalchemy extensions modifications.
9:* [stac_fastapi.sqlalchemy.extensions.query](query/)

docs/api/stac_fastapi/sqlalchemy/config.md
1:# Module stac_fastapi.sqlalchemy.config
9:### SqlalchemySettings
12:class SqlalchemySettings(

docs/api/stac_fastapi/sqlalchemy/version.md
1:# Module stac_fastapi.sqlalchemy.version

docs/api/stac_fastapi/sqlalchemy/index.md
1:# Module stac_fastapi.sqlalchemy
3:sqlalchemy submodule.
9:* [stac_fastapi.sqlalchemy.app](app/)
10:* [stac_fastapi.sqlalchemy.config](config/)
11:* [stac_fastapi.sqlalchemy.core](core/)
12:* [stac_fastapi.sqlalchemy.extensions](extensions/)
13:* [stac_fastapi.sqlalchemy.models](models/)
14:* [stac_fastapi.sqlalchemy.serializers](serializers/)
15:* [stac_fastapi.sqlalchemy.session](session/)
16:* [stac_fastapi.sqlalchemy.tokens](tokens/)
17:* [stac_fastapi.sqlalchemy.transactions](transactions/)
18:* [stac_fastapi.sqlalchemy.version](version/)

docs/api/stac_fastapi/sqlalchemy/core.md
1:# Module stac_fastapi.sqlalchemy.core
23:    token_table: Type[stac_fastapi.sqlalchemy.models.database.PaginationToken] = <class 'stac_fastapi.sqlalchemy.models.database.PaginationToken'>,
32:    session: stac_fastapi.sqlalchemy.session.Session = NOTHING,
33:    item_table: Type[stac_fastapi.sqlalchemy.models.database.Item] = <class 'stac_fastapi.sqlalchemy.models.database.Item'>,
34:    collection_table: Type[stac_fastapi.sqlalchemy.models.database.Collection] = <class 'stac_fastapi.sqlalchemy.models.database.Collection'>,
35:    item_serializer: Type[stac_fastapi.sqlalchemy.serializers.Serializer] = <class 'stac_fastapi.sqlalchemy.serializers.ItemSerializer'>,
36:    collection_serializer: Type[stac_fastapi.sqlalchemy.serializers.Serializer] = <class 'stac_fastapi.sqlalchemy.serializers.CollectionSerializer'>
42:* stac_fastapi.sqlalchemy.tokens.PaginationTokenClient

docs/api/stac_fastapi/sqlalchemy/session.md
1:# Module stac_fastapi.sqlalchemy.session
33:Returns a lazily-cached sqlalchemy engine for the instance's database_uri.
39:Returns a lazily-cached sqlalchemy sessionmaker using the instance's (lazily-cached) engine.
49:) -> Iterator[sqlalchemy.orm.session.Session]
61:) -> Iterator[sqlalchemy.orm.session.Session]
65:A generator function that yields a sqlalchemy orm session and cleans up the session once resumed after yielding.
75:) -> sqlalchemy.engine.base.Engine
79:Returns a new sqlalchemy engine using the instance's database_uri.
87:    engine: Union[sqlalchemy.engine.base.Engine, NoneType]
88:) -> sqlalchemy.orm.session.sessionmaker
92:Returns a new sessionmaker for the provided sqlalchemy engine. If no engine is provided, the
139:    settings: stac_fastapi.sqlalchemy.config.SqlalchemySettings

docs/api/stac_fastapi/sqlalchemy/tokens.md
1:# Module stac_fastapi.sqlalchemy.tokens
19:    session: stac_fastapi.sqlalchemy.session.Session = NOTHING,
20:    token_table: Type[stac_fastapi.sqlalchemy.models.database.PaginationToken] = <class 'stac_fastapi.sqlalchemy.models.database.PaginationToken'>
30:* stac_fastapi.sqlalchemy.core.CoreCrudClient

docs/api/stac_fastapi/sqlalchemy/transactions.md
1:# Module stac_fastapi.sqlalchemy.transactions
19:    session: stac_fastapi.sqlalchemy.session.Session = NOTHING,
21:    item_table: Type[stac_fastapi.sqlalchemy.models.database.Item] = <class 'stac_fastapi.sqlalchemy.models.database.Item'>,
22:    item_serializer: Type[stac_fastapi.sqlalchemy.serializers.Serializer] = <class 'stac_fastapi.sqlalchemy.serializers.ItemSerializer'>
46:Bulk item insertion using sqlalchemy core.
48:https://docs.sqlalchemy.org/en/13/faq/performance.html#i-m-inserting-400-000-rows-with-the-orm-and-it-s-really-slow
54:    session: stac_fastapi.sqlalchemy.session.Session = NOTHING,
55:    collection_table: Type[stac_fastapi.sqlalchemy.models.database.Collection] = <class 'stac_fastapi.sqlalchemy.models.database.Collection'>,
56:    item_table: Type[stac_fastapi.sqlalchemy.models.database.Item] = <class 'stac_fastapi.sqlalchemy.models.database.Item'>,
57:    item_serializer: Type[stac_fastapi.sqlalchemy.serializers.Serializer] = <class 'stac_fastapi.sqlalchemy.serializers.ItemSerializer'>,
58:    collection_serializer: Type[stac_fastapi.sqlalchemy.serializers.Serializer] = <class 'stac_fastapi.sqlalchemy.serializers.CollectionSerializer'>

docs/api/stac_fastapi/sqlalchemy/serializers.md
1:# Module stac_fastapi.sqlalchemy.serializers
19:* stac_fastapi.sqlalchemy.serializers.Serializer
29:    db_model: stac_fastapi.sqlalchemy.models.database.Collection,
42:    db_model: sqlalchemy.ext.declarative.api.Base
56:) -> stac_fastapi.sqlalchemy.models.database.Collection
72:* stac_fastapi.sqlalchemy.serializers.Serializer
82:    db_model: stac_fastapi.sqlalchemy.models.database.Item,
95:    db_model: sqlalchemy.ext.declarative.api.Base
109:) -> stac_fastapi.sqlalchemy.models.database.Item
129:* stac_fastapi.sqlalchemy.serializers.ItemSerializer
130:* stac_fastapi.sqlalchemy.serializers.CollectionSerializer
139:    db_model: sqlalchemy.ext.declarative.api.Base,
152:    db_model: sqlalchemy.ext.declarative.api.Base
166:) -> sqlalchemy.ext.declarative.api.Base

docs/api/stac_fastapi/extensions/core/index.md
317:* stac_fastapi.sqlalchemy.extensions.query.QueryExtension

docs/api/stac_fastapi/extensions/core/query/query.md
25:* stac_fastapi.sqlalchemy.extensions.query.QueryExtension

docs/api/stac_fastapi/extensions/core/query/index.md
30:* stac_fastapi.sqlalchemy.extensions.query.QueryExtension

docs/api/stac_fastapi/extensions/third_party/bulk_transactions.md
23:* stac_fastapi.sqlalchemy.transactions.BulkTransactionsClient

docs/api/stac_fastapi/index.md
11:* [stac_fastapi.sqlalchemy](sqlalchemy/)

README.md
39:- [stac-fastapi-sqlalchemy](https://github.com/stac-utils/stac-fastapi-sqlalchemy) Postgres backend implementation with [sqlalchemy](https://www.sqlalchemy.org/).
50:pip install stac-fastapi.sqlalchemy

CHANGES.md
13:  * **stac-fastapi-sqlalchemy**: <https://github.com/stac-utils/stac-fastapi-sqlalchemy>
25:* Required links to the sqlalchemy ItemCollection endpoint ([#508](https://github.com/stac-utils/stac-fastapi/pull/508))
45:* Manually exclude non-truthy optional values from sqlalchemy serialization of Collections ([#508](https://github.com/stac-utils/stac-fastapi/pull/508))
48:* 404 for missing collection on /items for sqlalchemy ([#528](https://github.com/stac-utils/stac-fastapi/pull/528))
121:* Make item geometry and bbox nullable in sqlalchemy backend. ([#398](https://github.com/stac-utils/stac-fastapi/pull/398))
137:* SQLAlchemy backend bulk item insert now works ([#356](https://github.com/stac-utils/stac-fastapi/issues/356))
190:* Update get_item in sqlalchemy backend to allow for querying for items with same ids but in different collections. ([#275](https://github.com/stac-utils/stac-fastapi/pull/275))
197:* Support non-interval datetime queries on sqlalchemy backend ([#262](https://github.com/stac-utils/stac-fastapi/pull/262))
198:* Restrict `limit` parameter in sqlalchemy backend to between 1 and 10,000. ([#251](https://github.com/stac-utils/stac-fastapi/pull/251))
215:* Added item_serializer and item_table to BulkTransactionsClient in sqlalchemy backend ([#210](https://github.com/stac-utils/stac-fastapi/pull/210))

docs/tips-and-tricks.md
8:To do this, edit `stac_fastapi/sqlalchemy/stac_fastapi/sqlalchemy/app.py` (or the equivalent in the `pgstac` folder) and add the following import:
23:The Context STAC extension provides information on the number of items matched and returned from a STAC search. This is required by various other STAC-related tools, such as the pystac command-line client. To enable the extension, edit `stac_fastapi/sqlalchemy/stac_fastapi/sqlalchemy/app.py` (or the equivalent in the `pgstac` folder) and add the following import:
Copy link
Copy Markdown
Collaborator

@moradology moradology left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The downstream repos are working as expected. There's a minor typo I caught in the README, but otherwise LGTM

Comment thread README.md Outdated
@gadomski gadomski mentioned this pull request Apr 28, 2023
4 tasks
@gadomski
Copy link
Copy Markdown
Member Author

gadomski commented May 1, 2023

I'm noticing a few spots in which old references exist in the docs.

Did you re-build the docs? I just did, and I'm not seeing any (all?) of those examples. The API docs are auto-generated.

I do see some dangling references in tips-and-tricks, will fix those.

@moradology
Copy link
Copy Markdown
Collaborator

I think you're right. I was misinterpreting the results of that grep

Copy link
Copy Markdown
Contributor

@mmcfarland mmcfarland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look good to me. I think there's one more file, scripts/wait-for-it.sh that is no longer used and could also be deleted.

As you mentioned in the PR, without a default backend, it's a little difficult to run/test changes without coordinating with a new backend repo. Do you have general (or specific) ideas about what the best dev workflow for updating this project with a backend? As a proof of concept, I tried mimicking a git submodule approach: cloning stac-fastapi into a gitignored subdirectory of stac-fastapi-pgstac and modifying the dockerfile there to do an editable install of these packages. Seemed a bit clumsy but should work. Perhaps when we've got a good flow we can update the development documentation here.

Copy link
Copy Markdown
Contributor

@pjhartzell pjhartzell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question about the docs.

Comment thread mkdocs.yml
@gadomski
Copy link
Copy Markdown
Member Author

gadomski commented May 9, 2023

Perhaps when we've got a good flow we can update the development documentation here.

Agreed.

Do you have general (or specific) ideas about what the best dev workflow for updating this project with a backend?

In the past, I've used my IDE's "workspace" concept, coupled with a virtual environment that has both packages installed in editable mode, to work on two repos at once. I think a similar approach could work here. That's relies more on a non-Docker development environment, so your submodule approach also seems good.

@gadomski gadomski enabled auto-merge (squash) May 9, 2023 18:28
@gadomski gadomski merged commit 8bbec40 into main May 9, 2023
@gadomski gadomski deleted the issues/432-split-backends branch May 9, 2023 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants