8000 Revert "feat: create alias alloydbconnector package" by rhatgadkar-goog · Pull Request #452 · GoogleCloudPlatform/alloydb-python-connector · GitHub
[go: up one dir, main page]

Skip to content

Revert "feat: create alias alloydbconnector package" #452

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 8 additions & 17 deletions README.md
10000 10000
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,9 @@ AlloyDB private IP address.

Please see [Configuring AlloyDB Connectivity][alloydb-connectivity] for more details.

There are two ways to import this AlloyDB connector package:
1. `import google.cloud.alloydbconnector`
2. `import google.cloud.alloydb.connector`

The preferred way is `import google.cloud.alloydbconnector` to avoid namespace
collisions with the [google-cloud-alloydb][alloydb-py-lib] package. Meanwhile,
`import google.cloud.alloydb.connector` will continue to work forever.

[vpc]: https://cloud.google.com/vpc/docs/vpc
[alloydb-connectivity]: https://cloud.google.com/alloydb/docs/configure-connectivity
[psc]: https://cloud.google.com/vpc/docs/private-service-connect
[alloydb-py-lib]: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-alloydb

### Synchronous Driver Usage

Expand All @@ -137,7 +128,7 @@ like `user`, `password` and `db` etc.
To use this connector with SQLAlchemy, use the `creator` argument for `sqlalchemy.create_engine`:

```python
from google.cloud.alloydbconnector import Connector
from google.cloud.alloydb.connector import Connector
import sqlalchemy

# initialize Connector object
Expand Down Expand Up @@ -197,7 +188,7 @@ calls to `connector.close()`.
Connector as a context manager:

```python
from google.cloud.alloydbconnector import Connector
from google.cloud.alloydb.connector import Connector
import sqlalchemy

# initialize Connector as context manager
Expand Down Expand Up @@ -248,7 +239,7 @@ currently supports the following asyncio database drivers:

```python
import asyncpg
from google.cloud.alloydbconnector import AsyncConnector
from google.cloud.alloydb.connector import AsyncConnector

async def main():
# initialize AsyncConnector object for connections to AlloyDB
Expand Down Expand Up @@ -282,7 +273,7 @@ import asyncpg
import sqlalchemy
from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine

from google.cloud.alloydbconnector import AsyncConnector
from google.cloud.alloydb.connector import AsyncConnector

async def init_connection_pool(connector: AsyncConnector) -> AsyncEngine:
# The AlloyDB Python Connector can be used along with SQLAlchemy using the
Expand Down Expand Up @@ -335,7 +326,7 @@ need for explicit calls to `connector.close()` to cleanup resources.

```python
import asyncpg
from google.cloud.alloydbconnector import AsyncConnector
from google.cloud.alloydb.connector import AsyncConnector

async def main():
# initialize AsyncConnector object for connections to AlloyDB
Expand Down Expand Up @@ -367,7 +358,7 @@ import asyncpg
import sqlalchemy
from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine

from google.cloud.alloydbconnector import AsyncConnector
from google.cloud.alloydb.connector import AsyncConnector

async def init_connection_pool(connector: AsyncConnector) -> AsyncEngine:
# The AlloyDB Python Connector can be used along with SQLAlchemy using the
Expand Down Expand Up @@ -462,7 +453,7 @@ and `"PSC"`.
Example:

```python
from google.cloud.alloydbconnector import Connector
from google.cloud.alloydb.connector import Connector

import sqlalchemy

Expand Down Expand Up @@ -498,7 +489,7 @@ Python Connector:
import logging

logging.basicConfig(format="%(asctime)s [%(levelname)s]: %(message)s")
logger = logging.getLogger(name="google.cloud.alloydbconnector")
logger = logging.getLogger(name="google.cloud.alloydb.connector")
logger.setLevel(logging.DEBUG)
```

Expand Down
10 changes: 5 additions & 5 deletions google/cloud/alloydb/connector/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from google.cloud.alloydbconnector import __version__
from google.cloud.alloydbconnector import AsyncConnector
from google.cloud.alloydbconnector import Connector
from google.cloud.alloydbconnector import IPTypes
from google.cloud.alloydbconnector import RefreshStrategy
from google.cloud.alloydb.connector.async_connector import AsyncConnector
from google.cloud.alloydb.connector.connector import Connector
from google.cloud.alloydb.connector.enums import IPTypes
from google.cloud.alloydb.connector.enums import RefreshStrategy
from google.cloud.alloydb.connector.version import __version__

__all__ = [
"__version__",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@
from google.auth.credentials import with_scopes_if_required
import google.auth.transport.requests

import google.cloud.alloydbconnector.asyncpg as asyncpg
from google.cloud.alloydbconnector.client import AlloyDBClient
from google.cloud.alloydbconnector.enums import IPTypes
from google.cloud.alloydbconnector.enums import RefreshStrategy
from google.cloud.alloydbconnector.exceptions import ClosedConnectorError
from google.cloud.alloydbconnector.instance import RefreshAheadCache
from google.cloud.alloydbconnector.lazy import LazyRefreshCache
from google.cloud.alloydbconnector.types import CacheTypes
from google.cloud.alloydbconnector.utils import generate_keys
from google.cloud.alloydbconnector.utils import strip_http_prefix
import google.cloud.alloydb.connector.asyncpg as asyncpg
from google.cloud.alloydb.connector.client import AlloyDBClient
from google.cloud.alloydb.connector.enums import IPTypes
from google.cloud.alloydb.connector.enums import RefreshStrategy
from google.cloud.alloydb.connector.exceptions import ClosedConnectorError
from google.cloud.alloydb.connector.instance import RefreshAheadCache
from google.cloud.alloydb.connector.lazy import LazyRefreshCache
from google.cloud.alloydb.connector.types import CacheTypes
from google.cloud.alloydb.connector.utils import generate_keys
from google.cloud.alloydb.connector.utils import strip_http_prefix

if TYPE_CHECKING:
from google.auth.credentials import Credentials
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
import google.cloud.alloydb_v1beta as v1beta
from google.protobuf import duration_pb2

from google.cloud.alloydbconnector.connection_info import ConnectionInfo
from google.cloud.alloydbconnector.version import __version__ as version
from google.cloud.alloydb.connector.connection_info import ConnectionInfo
from google.cloud.alloydb.connector.version import __version__ as version

if TYPE_CHECKING:
from google.auth.credentials import Credentials
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@

from aiofiles.tempfile import TemporaryDirectory

from google.cloud.alloydbconnector.exceptions import IPTypeNotFoundError
from google.cloud.alloydbconnector.utils import _write_to_file
from google.cloud.alloydb.connector.exceptions import IPTypeNotFoundError
from google.cloud.alloydb.connector.utils import _write_to_file

if TYPE_CHECKING:
import datetime

from cryptography.hazmat.primitives.asymmetric.types import PrivateKeyTypes

from google.cloud.alloydbconnector.enums import IPTypes
from google.cloud.alloydb.connector.enums import IPTypes

logger = logging.getLogger(name=__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@
from google.auth.credentials import with_scopes_if_required
from google.auth.transport import requests

from google.cloud.alloydb.connector.client import AlloyDBClient
from google.cloud.alloydb.connector.enums import IPTypes
from google.cloud.alloydb.connector.enums import RefreshStrategy
from google.cloud.alloydb.connector.exceptions import ClosedConnectorError
from google.cloud.alloydb.connector.instance import RefreshAheadCache
from google.cloud.alloydb.connector.lazy import LazyRefreshCache
import google.cloud.alloydb.connector.pg8000 as pg8000
from google.cloud.alloydb.connector.types import CacheTypes
from google.cloud.alloydb.connector.utils import generate_keys
from google.cloud.alloydb.connector.utils import strip_http_prefix
import google.cloud.alloydb_connectors_v1.proto.resources_pb2 as connectorspb
from google.cloud.alloydbconnector.client import AlloyDBClient
from google.cloud.alloydbconnector.enums import IPTypes
from google.cloud.alloydbconnector.enums import RefreshStrategy
from google.cloud.alloydbconnector.exceptions import ClosedConnectorError
from google.cloud.alloydbconnector.instance import RefreshAheadCache
from google.cloud.alloydbconnector.lazy import LazyRefreshCache
import google.cloud.alloydbconnector.pg8000 as pg8000
from google.cloud.alloydbconnector.types import CacheTypes
from google.cloud.alloydbconnector.utils import generate_keys
from google.cloud.alloydbconnector.utils import strip_http_prefix

if TYPE_CHECKING:
import ssl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@
import re
from typing import TYPE_CHECKING

from google.cloud.alloydbconnector.connection_info import ConnectionInfo
from google.cloud.alloydbconnector.exceptions import RefreshError
from google.cloud.alloydbconnector.rate_limiter import AsyncRateLimiter
from google.cloud.alloydbconnector.refresh_utils import _is_valid
from google.cloud.alloydbconnector.refresh_utils import _seconds_until_refresh
from google.cloud.alloydb.connector.connection_info import ConnectionInfo
from google.cloud.alloydb.connector.exceptions import RefreshError
from google.cloud.alloydb.connector.rate_limiter import AsyncRateLimiter
from google.cloud.alloydb.connector.refresh_utils import _is_valid
from google.cloud.alloydb.connector.refresh_utils import _seconds_until_refresh

if TYPE_CHECKING:
from cryptography.hazmat.primitives.asymmetric import rsa

from google.cloud.alloydbconnector.client import AlloyDBClient
from google.cloud.alloydb.connector.client import AlloyDBClient

logger = logging.getLogger(name=__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
import logging
from typing import Optional

from google.cloud.alloydbconnector.client import AlloyDBClient
from google.cloud.alloydbconnector.connection_info import ConnectionInfo
from google.cloud.alloydbconnector.instance import _parse_instance_uri
from google.cloud.alloydbconnector.refresh_utils import _refresh_buffer
from google.cloud.alloydb.connector.client import AlloyDBClient
from google.cloud.alloydb.connector.connection_info import ConnectionInfo
from google.cloud.alloydb.connector.instance import _parse_instance_uri
from google.cloud.alloydb.connector.refresh_utils import _refresh_buffer

logger = logging.getLogger(name=__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

from cryptography.hazmat.primitives import serialization

from google.cloud.alloydbconnector.connection_info import ConnectionInfo
from google.cloud.alloydb.connector.connection_info import ConnectionInfo


class StaticConnectionInfoCache:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

import typing

from google.cloud.alloydbconnector.instance import RefreshAheadCache
from google.cloud.alloydbconnector.lazy import LazyRefreshCache
from google.cloud.alloydbconnector.static import StaticConnectionInfoCache
from google.cloud.alloydb.connector.instance import RefreshAheadCache
from google.cloud.alloydb.connector.lazy import LazyRefreshCache
from google.cloud.alloydb.connector.static import StaticConnectionInfoCache

CacheTypes = typing.Union[
RefreshAheadCache, LazyRefreshCache, StaticConnectionInfoCache
Expand Down
26 changes: 0 additions & 26 deletions google/cloud/alloydbconnector/__init__.py

This file was deleted.

2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def default(session, path):
session.run(
"coverage",
"run",
"--include=*/google/cloud/alloydbconnector/*.py",
"--include=*/google/cloud/alloydb/connector/*.py",
"-m",
"pytest",
"-v",
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ pg8000 = ["pg8000>=1.31.1"]
asyncpg = ["asyncpg>=0.30.0"]

[tool.setuptools.dynamic]
version = { attr = "google.cloud.alloydbconnector.version.__version__" }
version = { attr = "google.cloud.alloydb.connector.version.__version__" }

[tool.setuptools.package-data]
"google.cloud.alloydbconnector" = ["py.typed"]
"google.cloud.alloydb.connector" = ["py.typed"]

[tool.setuptools.packages.find]
# Only include packages under the 'google' namespace. Do not include tests,
Expand Down
28 changes: 0 additions & 28 deletions tests/system/test_alloydb_connector_package.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/system/test_asyncpg_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import sqlalchemy
import sqlalchemy.ext.asyncio

from google.cloud.alloydbconnector import AsyncConnector
from google.cloud.alloydb.connector import AsyncConnector


async def create_sqlalchemy_engine(
Expand Down
2 changes: 1 addition & 1 deletion tests/system/test_asyncpg_iam_authn.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import sqlalchemy
import sqlalchemy.ext.asyncio

from google.cloud.alloydbconnector import AsyncConnector
from google.cloud.alloydb.connector import AsyncConnector


async def create_sqlalchemy_engine(
Expand Down
2 changes: 1 addition & 1 deletion tests/system/test_asyncpg_psc.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import sqlalchemy
import sqlalchemy.ext.asyncio

from google.cloud.alloydbconnector import AsyncConnector
from google.cloud.alloydb.connector import AsyncConnector


async def create_sqlalchemy_engine(
Expand Down
2 changes: 1 addition & 1 deletion tests/system/test_asyncpg_public_ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import sqlalchemy
import sqlalchemy.ext.asyncio

from google.cloud.alloydbconnector import AsyncConnector
from google.cloud.alloydb.connector import AsyncConnector


async def create_sqlalchemy_engine(
Expand Down
2 changes: 1 addition & 1 deletion tests/system/test_pg8000_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# [START alloydb_sqlalchemy_connect_connector]
import sqlalchemy

from google.cloud.alloydbconnector import Connector
from google.cloud.alloydb.connector import Connector


def create_sqlalchemy_engine(
Expand Down
2 changes: 1 addition & 1 deletion tests/system/test_pg8000_iam_authn.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# [START alloydb_sqlalchemy_connect_connector_iam_authn]
import sqlalchemy

from google.cloud.alloydbconnector import Connector
from google.cloud.alloydb.connector import Connector


def create_sqlalchemy_engine(
Expand Down
2 changes: 1 addition & 1 deletion tests/system/test_pg8000_psc.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import sqlalchemy

from google.cloud.alloydbconnector import Connector
from google.cloud.alloydb.connector import Connector


def create_sqlalchemy_engine(
Expand Down
Loading
0