-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: xiuzhu <edy@dodge-pro.local>
- Loading branch information
Showing
10 changed files
with
988 additions
and
3 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
dbgpt/app/static/_next/static/chunks/pages/_app-748b2808f934e1ed.js
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
dbgpt/app/static/_next/static/chunks/pages/database-107b1b057ad44146.js
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
from typing import Any, Optional | ||
from urllib.parse import quote | ||
from urllib.parse import quote_plus as urlquote | ||
|
||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
from dbgpt.datasource.rdbms.base import RDBMSDatabase | ||
|
||
|
||
class HiveConnect(RDBMSDatabase): | ||
"""db type""" | ||
|
||
db_type: str = "hive" | ||
"""db driver""" | ||
driver: str = "hive" | ||
"""db dialect""" | ||
dialect: str = "hive" | ||
|
||
@classmethod | ||
def from_uri_db( | ||
cls, | ||
host: str, | ||
port: int, | ||
user: str, | ||
pwd: str, | ||
db_name: str, | ||
engine_args: Optional[dict] = None, | ||
**kwargs: Any, | ||
) -> RDBMSDatabase: | ||
"""Construct a SQLAlchemy engine from uri database. | ||
Args: | ||
host (str): database host. | ||
port (int): database port. | ||
user (str): database user. | ||
pwd (str): database password. | ||
db_name (str): database name. | ||
engine_args (Optional[dict]):other engine_args. | ||
""" | ||
db_url: str = f"{cls.driver}://{host}:{str(port)}/{db_name}" | ||
if user and pwd: | ||
db_url: str = f"{cls.driver}://{quote(user)}:{urlquote(pwd)}@{host}:{str(port)}/{db_name}" | ||
return cls.from_uri(db_url, engine_args, **kwargs) | ||
|
||
def table_simple_info(self): | ||
return [] | ||
|
||
def get_users(self): | ||
return [] | ||
|
||
def get_grants(self): | ||
return [] | ||
|
||
def get_collation(self): | ||
"""Get collation.""" | ||
return "UTF-8" | ||
|
||
def get_charset(self): | ||
return "UTF-8" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters