mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-07-25 04:53:36 +00:00
format code
This commit is contained in:
parent
40fc8a664d
commit
613a8f1cbf
@ -1,11 +1,11 @@
|
|||||||
"""GaussDB connector."""
|
"""GaussDB connector."""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Any, Iterable, List, Optional, Tuple, Type, cast
|
from typing import Any, Iterable, List, Optional, Tuple, Type, cast
|
||||||
from urllib.parse import quote
|
from urllib.parse import quote
|
||||||
from urllib.parse import quote_plus as urlquote
|
from urllib.parse import quote_plus as urlquote
|
||||||
|
|
||||||
import psycopg2
|
|
||||||
from sqlalchemy import text
|
from sqlalchemy import text
|
||||||
|
|
||||||
from dbgpt.core.awel.flow import (
|
from dbgpt.core.awel.flow import (
|
||||||
@ -19,14 +19,11 @@ from dbgpt.util.i18n_utils import _
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@auto_register_resource(
|
@auto_register_resource(
|
||||||
label=_("GaussDB datasource"),
|
label=_("GaussDB datasource"),
|
||||||
category=ResourceCategory.DATABASE,
|
category=ResourceCategory.DATABASE,
|
||||||
tags={"order": TAGS_ORDER_HIGH},
|
tags={"order": TAGS_ORDER_HIGH},
|
||||||
description=_(
|
description=_("Huawei's distributed database with PostgreSQL/MySQL compatibility."),
|
||||||
"Huawei's distributed database with PostgreSQL/MySQL compatibility."
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
@dataclass
|
@dataclass
|
||||||
class GaussDBParameters(RDBMSDatasourceParameters):
|
class GaussDBParameters(RDBMSDatasourceParameters):
|
||||||
@ -79,6 +76,7 @@ class GaussDBConnector(RDBMSConnector):
|
|||||||
f"{cls.driver}://{quote(user)}:{urlquote(pwd)}@{host}:{str(port)}/{db_name}"
|
f"{cls.driver}://{quote(user)}:{urlquote(pwd)}@{host}:{str(port)}/{db_name}"
|
||||||
)
|
)
|
||||||
from sqlalchemy.dialects.postgresql.base import PGDialect
|
from sqlalchemy.dialects.postgresql.base import PGDialect
|
||||||
|
|
||||||
PGDialect._get_server_version_info = lambda *args: (7, 0)
|
PGDialect._get_server_version_info = lambda *args: (7, 0)
|
||||||
return cast(GaussDBConnector, cls.from_uri(db_url, engine_args, **kwargs))
|
return cast(GaussDBConnector, cls.from_uri(db_url, engine_args, **kwargs))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user