Skip to content

Commit

Permalink
[优化]USERPATH
Browse files Browse the repository at this point in the history
  • Loading branch information
longfengpili committed Aug 3, 2023
1 parent 1ed263d commit 3359528
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
7 changes: 2 additions & 5 deletions pydbapi/api/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# @Author: longfengpili
# @Date: 2023-06-02 15:27:41
# @Last Modified by: longfengpili
# @Last Modified time: 2023-07-27 15:32:24
# @Last Modified time: 2023-08-03 11:59:33
# @github: https://github.com/longfengpili


Expand All @@ -17,9 +17,6 @@
sqlitelogger = logging.getLogger(__name__)


USERPATH = os.environ['USERPROFILE'] if 'USERPROFILE' in os.environ else os.environ['HOME'] if 'HOME' in os.environ else ''


class SqliteCompile(SqlCompile):
'''[summary]
Expand All @@ -46,7 +43,7 @@ class SqliteDB(DBMixin, DBFileExec):
_instance_lock = threading.Lock()

def __init__(self, database=None):
self.database = database if database else os.path.join(USERPATH, 'sqlite3_test.db')
self.database = database if database else os.path.join(os.path.expanduser('~'), 'sqlite3_test.db')
super(SqliteDB, self).__init__()

# def __new__(cls, *args, **kwargs):
Expand Down
5 changes: 2 additions & 3 deletions pydbapi/conf/logconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# @Author: longfengpili
# @Date: 2023-07-26 17:46:27
# @Last Modified by: longfengpili
# @Last Modified time: 2023-07-27 17:17:47
# @Last Modified time: 2023-08-03 11:58:10
# @github: https://github.com/longfengpili


Expand All @@ -15,8 +15,7 @@
REDSHIFT_AUTO_RULES = AUTO_RULES + ['_data_aniland'] # Amazon Redshift 可以自动执行表名(表名包含即可)

# logging settings
USERPATH = os.environ['USERPROFILE'] if 'USERPROFILE' in os.environ else os.environ['HOME'] if 'HOME' in os.environ else ''
LOG_BASE_PATH = os.path.join(USERPATH, 'snapilog') # 可以user目录下查看日志
LOG_BASE_PATH = os.path.join(os.path.expanduser('~'), 'pydbapilog') # 可以user目录下查看日志
PROJECT_NAME = re.sub(':?\\\\', '_', os.getcwd())
PROJECT_NAME = PROJECT_NAME[1:] if PROJECT_NAME.startswith('/') else PROJECT_NAME # linux

Expand Down

0 comments on commit 3359528

Please sign in to comment.