Skip to content

Commit 2ede2a5

Browse files
authored
Update REDME to ad DeepWiki (#21)
* update README and comments * update readme
1 parent 7b277f7 commit 2ede2a5

2 files changed

Lines changed: 31 additions & 21 deletions

File tree

README.md

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,39 @@
11
# Aloha!
22

3+
## What is it?
4+
5+
`aloha` is a versatile Python utility package for building microservices.
6+
37
[![License](https://img.shields.io/github/license/QPod/aloha)](https://github.com/QPod/aloha/blob/main/LICENSE)
48
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/QPod/aloha-python/pip.yml?branch=main)](https://github.com/QPod/aloha-python/actions)
5-
[![Join the Gitter Chat](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/QPod/)
6-
[![PyPI version](https://img.shields.io/pypi/v/aloha)](https://pypi.python.org/pypi/aloha/)
7-
[![PyPI Downloads](https://img.shields.io/pypi/dm/aloha)](https://pepy.tech/badge/aloha/)
89
[![Code Activity](https://img.shields.io/github/commit-activity/m/QPod/aloha)](https://github.com/QPod/aloha/pulse)
910
[![Recent Code Update](https://img.shields.io/github/last-commit/QPod/docker-images.svg)](https://github.com/QPod/aloha/stargazers)
1011

11-
Please generously STAR★ our project or donate to us! [![GitHub Starts](https://img.shields.io/github/stars/QPod/aloha.svg?label=Stars&style=social)](https://github.com/QPod/aloha/stargazers)
12+
[![PyPI version](https://img.shields.io/pypi/v/aloha)](https://pypi.python.org/pypi/aloha/)
13+
[![PyPI Downloads](https://img.shields.io/pypi/dm/aloha)](https://pepy.tech/badge/aloha/)
14+
15+
---
16+
17+
Please generously STAR★ our project or donate to us!
18+
[![GitHub Starts](https://img.shields.io/github/stars/QPod/aloha.svg?label=Stars&style=social)](https://github.com/QPod/aloha/stargazers)
1219
[![Donate-PayPal](https://img.shields.io/badge/Donate-PayPal-blue.svg)](https://paypal.me/haobibo)
1320
[![Donate-AliPay](https://img.shields.io/badge/Donate-Alipay-blue.svg)](https://raw.githubusercontent.com/wiki/haobibo/resources/img/Donate-AliPay.png)
1421
[![Donate-WeChat](https://img.shields.io/badge/Donate-WeChat-green.svg)](https://raw.githubusercontent.com/wiki/haobibo/resources/img/Donate-WeChat.png)
1522

16-
## What is it?
17-
18-
`aloha` is a versatile Python utility package for building microservices.
23+
- For questions, try DeepWiki: [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/QPod/aloha-python)
1924

20-
[📚 Document & 中文文档](https://aloha-python.readthedocs.io/)
25+
- To contribute or talk to a human: [![Open an Issue on GitHub](https://img.shields.io/github/issues/QPod/aloha-python)](https://github.com/QPod/aloha-python/issues) [![Join the Discord Chat](https://img.shields.io/badge/Discuss_on-Discord-green)](https://discord.gg/kHUzgQxgbJ)
2126

2227
## Getting started
2328

29+
Refer to[📚 Document & 中文文档](https://aloha-python.readthedocs.io/) for detailed introduction.
30+
2431
```shell
2532
pip install aloha[all]
2633
```
34+
35+
And then:
36+
```python
37+
from aloha.logger import LOG
38+
from aloha.settings import SETTINGS as S
39+
```

src/aloha/db/duckdb.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@
1212

1313
class DuckOperator:
1414
def __init__(self, db_config, **kwargs):
15-
"""
16-
db_config example:
15+
"""db_config example:
1716
{
18-
"path": "/path/to/db.duckdb", # 数据库文件路径,使用 ":memory:" 表示内存模式
19-
"schema": "sales", # 可选,默认 'main'
20-
"read_only": True, # 可选,默认 False (内存模式下强制为 False)
21-
"config": {"memory_limit": "500mb"}# 可选,DuckDB 连接配置
17+
"path": "/path/to/db.duckdb", # file path of duckdb, use ":memory:" for in-memory mode
18+
"schema": "sales", # optional, 'main' by default
19+
"read_only": True, # optional, False by default, (will set to False if in in-memory mode)
20+
"config": {"memory_limit": "500mb"}, # optional, duckdb connection configs
2221
}
2322
"""
2423
self._config = {
@@ -28,10 +27,10 @@ def __init__(self, db_config, **kwargs):
2827
'config': db_config.get('config', {}),
2928
}
3029

31-
if not self._config['path'] or self._config['path'] == ':memory:': # 标准化内存模式路径
30+
if not self._config['path'] or self._config['path'] == ':memory:': # in-memroy mode
3231
self._config['path'] = ':memory:'
3332

34-
if self._config['read_only']: # 内存数据库不支持只读模式
33+
if self._config['read_only']: # in-memory mode cannot be read-only
3534
LOG.warning("In-memory database cannot be read-only. Setting read_only=False.")
3635
self._config['read_only'] = False
3736

@@ -50,16 +49,14 @@ def __init__(self, db_config, **kwargs):
5049
).connect()
5150

5251
self._initialize_schema()
53-
54-
LOG.debug(
55-
f"DuckDB connected: {self._config['path']} [schema={self._config['schema']}, read_only={self._config['read_only']}]"
56-
)
52+
msg = f"DuckDB connected: {self._config['path']} [schema={self._config['schema']}, read_only={self._config['read_only']}]"
53+
LOG.debug(msg)
5754
except Exception as e:
5855
LOG.exception(e)
5956
raise RuntimeError('Failed to connect to DuckDB')
6057

6158
def _prepare_database(self):
62-
"""准备数据库文件和目录"""
59+
"""Prepare the database file and its parent directory."""
6360
path = self._config['path']
6461
path_obj = Path(path)
6562

0 commit comments

Comments
 (0)