pydbapi


Namepydbapi JSON
Version 0.0.138 PyPI version JSON
download
home_pagehttps://pypi.org/project/pydbapi/
SummaryA simple database API
upload_time2024-11-21 08:07:05
maintainerNone
docs_urlNone
authorlongfengpili
requires_python>=3.9
licenseNone
keywords dbapi sqlite3 redshift snowflake doris trino
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pydbapi

## Installation
```python
pip install pydbapi
```

## 支持的数据库类型
+ sqlite
```python
from pydbapi.api import SqliteDB
db = SqliteDB(database=None)  # 或者传入路径
sql = 'select * from [table];'
cursor, action, result = db.execute(sql)
```
+ Amazon Redshift
```python
from pydbapi.api import RedshiftDB
db = RedshiftDB(host, user, password, database, port='5439', safe_rule=True)
sql = 'select * from [schema].[table];'
cursor, action, result = db.execute(sql)
```
+ Mysql
```python
from pydbapi.api import MysqlDB
db = MysqlDB(host, user, password, database, port=3306, safe_rule=True, isdoris=False)
sql = 'select * from [table];'
cursor, action, result = db.execute(sql)
```
+ Trino
```python
from pydbapi.api import TrinoDB
db = TrinoDB(host, user, password, database, catalog, port=8443, safe_rule=True)
sql = 'select * from [table];'
cursor, action, result = db.execute(sql)
```
+ Snowflake(删除)
```python
from pydbapi.api import SnowflakeDB
db = SnowflakeDB(user, password, account, warehouse, database, schema, safe_rule=True)
sql = 'select * from [table];'
cursor, action, result = db.execute(sql)
```

+ instance模式
```python
from pydbapi.api import SqliteDB
db = SqliteDB.get_instance(database=None)  # 或者传入路径
sql = 'select * from [table];'
cursor, action, result = db.execute(sql)
```

## Result
+ 转换成dataframe
```python
from pydbapi.api import TrinoDB
db = TrinoDB(host, user, password, database, catalog, port=8443, safe_rule=True)
sql = 'select * from [table];'
cursor, action, result = db.execute(sql)

df = result.to_dataframe()
df
```
+ 输出到csv
```python
from pydbapi.api import TrinoDB
db = TrinoDB(host, user, password, database, catalog, port=8443, safe_rule=True)
sql = 'select * from [table];'
cursor, action, result = db.execute(sql)

result.to_csv(outfile)
```

## Column
`from pydbapi.model import ColumnModel`
+ ColumnModel
    + 代码
        `col = ColumnModel(newname, coltype='varchar', sqlexpr=None, func=None, order=0)`
    + params
        * `newname`: 新命名;
        * `coltype`: 类型
        * `sqlexpr`: 查询sql表达式
        * `func`: 查询函数,暂时支持'min', 'max', 'sum', 'count'
        * `order`: 排序

+ ColumnsModel
    + 代码
        `cols = ColumnsModel(ColumnModel, ColumnModel, ……)`
    + property
        * `func_cols`: 返回col列表
        * `nonfunc_cols`: 返回col列表
        * `new_cols`: 返回拼接字符串
        * `create_cols`: 返回拼接字符串
        * `select_cols`: 返回拼接字符串
        * `group_cols`: 返回拼接字符串
        * `order_cols`: 返回拼接字符串
    + mothed
        * get_column_by_name
            - `cols.get_column_by_name(name)`
            - 返回`ColumnModel`
            
## Sql
+ SqlStatement
```python
from pydbapi.sql import SqlStatement
sql = 'select * from tablename where part_date >= $part_date;'
sqlstmt = SqlStatement(sql)
```

+ **属性**  

    - tokens  
    - sql
    - comment
    - action
    - tablename
    - params
    - subqueries

+ **方法**  

    + from_sqlsnippets
    ```python
    sstmt1 = '-- comment'
    sqlstmt = SqlStatement.from_sqlsnippets(sstmt1, sql)
    ```
    + add
    ```python
    sstmt2 = 'and part_date <= $end_date'
    sqlstmt += sstmt2
    ```
    + sub
    ```python
    sqlstmt -= sstmt2
    ```
    + substitute_params
    ```python
    sqlstmt = sqlstmt.substitute_params(part_date="'2024-01-01'")
    ```
    + get_with_testsql(only support CETs)
    ```python
    sqlstmt = sqlstmt.get_with_testsql(idx=1)
    ```

+ SqlStatements
```python
from pydbapi.sql import SqlStatements
sql = '''
    select * from tablename1 where part_date >= $part_date;
    select * from tablename2 where part_date >= $part_date;
'''
sqlstmts = SqlStatements(sql)
```

+ **属性**  

    - statements  
    - SqlStatement的属性

+ **方法**  

    + SqlStatement
    ```python
    sqlstmts = sqlstmts.substitute_params(part_date='2024-01-01')
    ```
    + iter
    ```python
    for stmts in sqlstmts:
        stmts
    ```
    - len
    ```python
    len(sqlstmts)
    ```
    - getitem
    ```python
    sqlstmts[0]
    sqlstmts[:2]
    ```


## 支持的操作
+ execute[【db/base.py】](https://github.com/longfengpili/pydbapi/blob/master/pydbapi/db/base.py)
    + 代码  
        `db.execute(sql, count=None, ehandling=None, verbose=0)`
    + params
        * `count`: 返回结果的数量;
        * `ehandling`: sql执行出错的时候处理方式, default: None
        * `verbose`: 执行的进度展示方式(0:不打印, 1:文字进度, 2:进度条)
+ select
    + 代码  
        `db.select(tablename, columns, condition=None, verbose=0)`
    + params
        * `tablename`: 表名;
        * `columns`: 列内容; 
        * `condition`: sql where 中的条件
+ create
    + sqlite/redshift
        + 代码  
        `db.create(tablename, columns, indexes=None, verbose=0)`
        + params
            - `tablename`: 表名;
            - `columns`: 列内容;
            - `indexes`: 索引,sqlite暂不支持索引
            - `verbose`: 是否打印执行进度。
    + mysql
        + 代码  
        `db.create(tablename, columns, indexes=None, index_part=128, ismultiple_index=True, partition=None, verbose=0)`
        + params
            - `tablename`: 表名;
            - `columns`: 列内容;
            - `indexes`: 索引
            - `index_part`: 索引part
            - `ismultiple_index`: 多重索引
            - `partition`: 分区
            - `verbose`: 是否打印执行进度。
    + trino
        + 代码  
        `db.create(tablename, columns, partition=None, verbose=0)`
        + params
            - `tablename`: 表名;
            - `columns`: 列内容;
            - `partition`: 分区
            - `verbose`: 是否打印执行进度。
+ insert[【db/base.py】](https://github.com/longfengpili/pydbapi/blob/master/pydbapi/db/base.py)
    + 代码  
        `db.insert(tablename, columns, inserttype='value', values=None, chunksize=1000, fromtable=None, condition=None)`
    + params
        * `tablename`: 表名;
        * `columns`: 列内容;
        * `inserttype`: 插入数据类型,支持value、select
        * `values`: inserttype='value',插入的数值; 
        * `chunksize`: inserttype='value', 每个批次插入的量级; 
        * `fromtable`: inserttype='select',数据来源表;
        * `condition`:  inserttype='select',数据来源条件;
+ drop[【db/base.py】](https://github.com/longfengpili/pydbapi/blob/master/pydbapi/db/base.py)
    + 代码  
        `db.drop(tablename)`
    + params
        * `tablename`: 表名;
+ delete[【db/base.py】](https://github.com/longfengpili/pydbapi/blob/master/pydbapi/db/base.py)
    + 代码  
        `db.delete(tablename, condition)`
    + params
        * `tablename`: 表名;
        * `condition`: 插入的数值; 
+ get_columns
    + 代码  
        `db.get_columns(tablename)`
    + params
        * `tablename`: 表名;
+ add_columns
    + 代码  
        `db.add_columns(tablename, columns)`
    + params
        * `tablename`: 表名;
        * `columns`: 列内容; 
+ get_filesqls[【db/fileexec.py】](https://github.com/longfengpili/pydbapi/blob/master/pydbapi/db/fileexec.py)
    + 代码  
        `db.get_filesqls(filepath, **kw)`
    + params
        * `filepath`: sql文件路径;
        * `kw`: sql文件中需要替换的参数,会替换sqlfile中的arguments;
+ file_exec[【db/fileexec.py】](https://github.com/longfengpili/pydbapi/blob/master/pydbapi/db/fileexec.py)
    + 代码  
        `db.file_exec(filepath, ehandling=None, verbose=0, **kw)`
    + params
        * `filepath`: sql文件路径; 文件名以<font color=red>`test`</font>开始或者结尾会打印sql执行的步骤;
        * `ehandling`: sql执行出错的时候处理方式, default: None
        * `verbose`: 执行的进度展示方式(0:不打印, 1:文字进度, 2:进度条)
        * `kw`: sql文件中需要替换的参数 在sql文件中用`$param`, 会替换sqlfile中的arguments;
    + sql文件格式(在desc中增加<font color=red>`verbose`</font>会打印sql执行的步骤;)
        ```sql
        #【arguments】#
        ts = '2020-06-28'
        date = today
        date_max = date + timedelta(days=10)
        #【arguments】#
        ###
        --【desc1 [verbose]】 #sql描述
        --step1
        sql1;
        --step2
        sql2 where name = $name;
        ###
        ###
        --【desc2 [verbose]】 #sql描述
        --step1
        sql1;
        --step2
        sql2;
        ###
        ```
    + arguments
        * 支持python表达式(datetime、date、timedelta)
        * 支持全局变量和当前sqlfile设置过的变量
        * now:获取执行的时间
        * today: 获取执行的日期

## 魔法命令
+ 注册方法  
命令行中执行`pydbapimagic`

+ 参数
    * 帮助  
    `%dbconfig`
    * 配置  
        ```python
        %dbconfig DBTYPE = 'mysql'
        %dbconfig HOST = 'localhost'
        %dbconfig USER = 'longfengpili'
        %dbconfig PASSWORD = '123456abc'
        %dbconfig DATABASE = 'test'
        %dbconfig PORT = 3306
        ```
    * 查看  
    `%dbconfig DBTYPE`

## 支持的的settings[【conf/settings.py】](https://github.com/longfengpili/pydbapi/blob/master/pydbapi/conf/logconf.py)
+ AUTO_RULES  
    可以自动执行表名(表名包含即可)

            

Raw data

            {
    "_id": null,
    "home_page": "https://pypi.org/project/pydbapi/",
    "name": "pydbapi",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "dbapi, sqlite3, redshift, snowflake, doris, trino",
    "author": "longfengpili",
    "author_email": "398745129@qq.com",
    "download_url": "https://files.pythonhosted.org/packages/ce/54/d0e8bb6854695b33e3f39b594ad292b278c6e2c3a4a70d309ac23adb12be/pydbapi-0.0.138.tar.gz",
    "platform": null,
    "description": "# pydbapi\n\n## Installation\n```python\npip install pydbapi\n```\n\n## \u652f\u6301\u7684\u6570\u636e\u5e93\u7c7b\u578b\n+ sqlite\n```python\nfrom pydbapi.api import SqliteDB\ndb = SqliteDB(database=None)  # \u6216\u8005\u4f20\u5165\u8def\u5f84\nsql = 'select * from [table];'\ncursor, action, result = db.execute(sql)\n```\n+ Amazon Redshift\n```python\nfrom pydbapi.api import RedshiftDB\ndb = RedshiftDB(host, user, password, database, port='5439', safe_rule=True)\nsql = 'select * from [schema].[table];'\ncursor, action, result = db.execute(sql)\n```\n+ Mysql\n```python\nfrom pydbapi.api import MysqlDB\ndb = MysqlDB(host, user, password, database, port=3306, safe_rule=True, isdoris=False)\nsql = 'select * from [table];'\ncursor, action, result = db.execute(sql)\n```\n+ Trino\n```python\nfrom pydbapi.api import TrinoDB\ndb = TrinoDB(host, user, password, database, catalog, port=8443, safe_rule=True)\nsql = 'select * from [table];'\ncursor, action, result = db.execute(sql)\n```\n+ Snowflake(\u5220\u9664)\n```python\nfrom pydbapi.api import SnowflakeDB\ndb = SnowflakeDB(user, password, account, warehouse, database, schema, safe_rule=True)\nsql = 'select * from [table];'\ncursor, action, result = db.execute(sql)\n```\n\n+ instance\u6a21\u5f0f\n```python\nfrom pydbapi.api import SqliteDB\ndb = SqliteDB.get_instance(database=None)  # \u6216\u8005\u4f20\u5165\u8def\u5f84\nsql = 'select * from [table];'\ncursor, action, result = db.execute(sql)\n```\n\n## Result\n+ \u8f6c\u6362\u6210dataframe\n```python\nfrom pydbapi.api import TrinoDB\ndb = TrinoDB(host, user, password, database, catalog, port=8443, safe_rule=True)\nsql = 'select * from [table];'\ncursor, action, result = db.execute(sql)\n\ndf = result.to_dataframe()\ndf\n```\n+ \u8f93\u51fa\u5230csv\n```python\nfrom pydbapi.api import TrinoDB\ndb = TrinoDB(host, user, password, database, catalog, port=8443, safe_rule=True)\nsql = 'select * from [table];'\ncursor, action, result = db.execute(sql)\n\nresult.to_csv(outfile)\n```\n\n## Column\n`from pydbapi.model import ColumnModel`\n+ ColumnModel\n    + \u4ee3\u7801\n        `col = ColumnModel(newname, coltype='varchar', sqlexpr=None, func=None, order=0)`\n    + params\n        * `newname`: \u65b0\u547d\u540d\uff1b\n        * `coltype`: \u7c7b\u578b\n        * `sqlexpr`: \u67e5\u8be2sql\u8868\u8fbe\u5f0f\n        * `func`: \u67e5\u8be2\u51fd\u6570\uff0c\u6682\u65f6\u652f\u6301'min', 'max', 'sum', 'count'\n        * `order`: \u6392\u5e8f\n\n+ ColumnsModel\n    + \u4ee3\u7801\n        `cols = ColumnsModel(ColumnModel, ColumnModel, \u2026\u2026)`\n    + property\n        * `func_cols`: \u8fd4\u56decol\u5217\u8868\n        * `nonfunc_cols`: \u8fd4\u56decol\u5217\u8868\n        * `new_cols`: \u8fd4\u56de\u62fc\u63a5\u5b57\u7b26\u4e32\n        * `create_cols`: \u8fd4\u56de\u62fc\u63a5\u5b57\u7b26\u4e32\n        * `select_cols`: \u8fd4\u56de\u62fc\u63a5\u5b57\u7b26\u4e32\n        * `group_cols`: \u8fd4\u56de\u62fc\u63a5\u5b57\u7b26\u4e32\n        * `order_cols`: \u8fd4\u56de\u62fc\u63a5\u5b57\u7b26\u4e32\n    + mothed\n        * get_column_by_name\n            - `cols.get_column_by_name(name)`\n            - \u8fd4\u56de`ColumnModel`\n            \n## Sql\n+ SqlStatement\n```python\nfrom pydbapi.sql import SqlStatement\nsql = 'select * from tablename where part_date >= $part_date;'\nsqlstmt = SqlStatement(sql)\n```\n\n+ **\u5c5e\u6027**  \n\n    - tokens  \n    - sql\n    - comment\n    - action\n    - tablename\n    - params\n    - subqueries\n\n+ **\u65b9\u6cd5**  \n\n    + from_sqlsnippets\n    ```python\n    sstmt1 = '-- comment'\n    sqlstmt = SqlStatement.from_sqlsnippets(sstmt1, sql)\n    ```\n    + add\n    ```python\n    sstmt2 = 'and part_date <= $end_date'\n    sqlstmt += sstmt2\n    ```\n    + sub\n    ```python\n    sqlstmt -= sstmt2\n    ```\n    + substitute_params\n    ```python\n    sqlstmt = sqlstmt.substitute_params(part_date=\"'2024-01-01'\")\n    ```\n    + get_with_testsql(only support CETs)\n    ```python\n    sqlstmt = sqlstmt.get_with_testsql(idx=1)\n    ```\n\n+ SqlStatements\n```python\nfrom pydbapi.sql import SqlStatements\nsql = '''\n    select * from tablename1 where part_date >= $part_date;\n    select * from tablename2 where part_date >= $part_date;\n'''\nsqlstmts = SqlStatements(sql)\n```\n\n+ **\u5c5e\u6027**  \n\n    - statements  \n    - SqlStatement\u7684\u5c5e\u6027\n\n+ **\u65b9\u6cd5**  \n\n    + SqlStatement\n    ```python\n    sqlstmts = sqlstmts.substitute_params(part_date='2024-01-01')\n    ```\n    + iter\n    ```python\n    for stmts in sqlstmts:\n        stmts\n    ```\n    - len\n    ```python\n    len(sqlstmts)\n    ```\n    - getitem\n    ```python\n    sqlstmts[0]\n    sqlstmts[:2]\n    ```\n\n\n## \u652f\u6301\u7684\u64cd\u4f5c\n+ execute[\u3010db/base.py\u3011](https://github.com/longfengpili/pydbapi/blob/master/pydbapi/db/base.py)\n    + \u4ee3\u7801  \n        `db.execute(sql, count=None, ehandling=None, verbose=0)`\n    + params\n        * `count`: \u8fd4\u56de\u7ed3\u679c\u7684\u6570\u91cf;\n        * `ehandling`: sql\u6267\u884c\u51fa\u9519\u7684\u65f6\u5019\u5904\u7406\u65b9\u5f0f, default: None\n        * `verbose`: \u6267\u884c\u7684\u8fdb\u5ea6\u5c55\u793a\u65b9\u5f0f\uff080\uff1a\u4e0d\u6253\u5370\uff0c 1\uff1a\u6587\u5b57\u8fdb\u5ea6\uff0c 2\uff1a\u8fdb\u5ea6\u6761\uff09\n+ select\n    + \u4ee3\u7801  \n        `db.select(tablename, columns, condition=None, verbose=0)`\n    + params\n        * `tablename`: \u8868\u540d;\n        * `columns`\uff1a \u5217\u5185\u5bb9; \n        * `condition`: sql where \u4e2d\u7684\u6761\u4ef6\n+ create\n    + sqlite/redshift\n        + \u4ee3\u7801  \n        `db.create(tablename, columns, indexes=None, verbose=0)`\n        + params\n            - `tablename`: \u8868\u540d;\n            - `columns`\uff1a \u5217\u5185\u5bb9;\n            - `indexes`: \u7d22\u5f15\uff0csqlite\u6682\u4e0d\u652f\u6301\u7d22\u5f15\n            - `verbose`\uff1a \u662f\u5426\u6253\u5370\u6267\u884c\u8fdb\u5ea6\u3002\n    + mysql\n        + \u4ee3\u7801  \n        `db.create(tablename, columns, indexes=None, index_part=128, ismultiple_index=True, partition=None, verbose=0)`\n        + params\n            - `tablename`: \u8868\u540d;\n            - `columns`\uff1a \u5217\u5185\u5bb9;\n            - `indexes`: \u7d22\u5f15\n            - `index_part`: \u7d22\u5f15part\n            - `ismultiple_index`: \u591a\u91cd\u7d22\u5f15\n            - `partition`: \u5206\u533a\n            - `verbose`\uff1a \u662f\u5426\u6253\u5370\u6267\u884c\u8fdb\u5ea6\u3002\n    + trino\n        + \u4ee3\u7801  \n        `db.create(tablename, columns, partition=None, verbose=0)`\n        + params\n            - `tablename`: \u8868\u540d;\n            - `columns`\uff1a \u5217\u5185\u5bb9;\n            - `partition`: \u5206\u533a\n            - `verbose`\uff1a \u662f\u5426\u6253\u5370\u6267\u884c\u8fdb\u5ea6\u3002\n+ insert[\u3010db/base.py\u3011](https://github.com/longfengpili/pydbapi/blob/master/pydbapi/db/base.py)\n    + \u4ee3\u7801  \n        `db.insert(tablename, columns, inserttype='value', values=None, chunksize=1000, fromtable=None, condition=None)`\n    + params\n        * `tablename`: \u8868\u540d;\n        * `columns`\uff1a \u5217\u5185\u5bb9;\n        * `inserttype`: \u63d2\u5165\u6570\u636e\u7c7b\u578b\uff0c\u652f\u6301value\u3001select\n        * `values`: inserttype='value',\u63d2\u5165\u7684\u6570\u503c; \n        * `chunksize`: inserttype='value', \u6bcf\u4e2a\u6279\u6b21\u63d2\u5165\u7684\u91cf\u7ea7; \n        * `fromtable`: inserttype='select',\u6570\u636e\u6765\u6e90\u8868;\n        * `condition`:  inserttype='select',\u6570\u636e\u6765\u6e90\u6761\u4ef6;\n+ drop[\u3010db/base.py\u3011](https://github.com/longfengpili/pydbapi/blob/master/pydbapi/db/base.py)\n    + \u4ee3\u7801  \n        `db.drop(tablename)`\n    + params\n        * `tablename`: \u8868\u540d;\n+ delete[\u3010db/base.py\u3011](https://github.com/longfengpili/pydbapi/blob/master/pydbapi/db/base.py)\n    + \u4ee3\u7801  \n        `db.delete(tablename, condition)`\n    + params\n        * `tablename`: \u8868\u540d;\n        * `condition`: \u63d2\u5165\u7684\u6570\u503c; \n+ get_columns\n    + \u4ee3\u7801  \n        `db.get_columns(tablename)`\n    + params\n        * `tablename`: \u8868\u540d;\n+ add_columns\n    + \u4ee3\u7801  \n        `db.add_columns(tablename, columns)`\n    + params\n        * `tablename`: \u8868\u540d;\n        * `columns`\uff1a \u5217\u5185\u5bb9; \n+ get_filesqls[\u3010db/fileexec.py\u3011](https://github.com/longfengpili/pydbapi/blob/master/pydbapi/db/fileexec.py)\n    + \u4ee3\u7801  \n        `db.get_filesqls(filepath, **kw)`\n    + params\n        * `filepath`: sql\u6587\u4ef6\u8def\u5f84;\n        * `kw`\uff1a sql\u6587\u4ef6\u4e2d\u9700\u8981\u66ff\u6362\u7684\u53c2\u6570\uff0c\u4f1a\u66ff\u6362sqlfile\u4e2d\u7684arguments;\n+ file_exec[\u3010db/fileexec.py\u3011](https://github.com/longfengpili/pydbapi/blob/master/pydbapi/db/fileexec.py)\n    + \u4ee3\u7801  \n        `db.file_exec(filepath, ehandling=None, verbose=0, **kw)`\n    + params\n        * `filepath`: sql\u6587\u4ef6\u8def\u5f84; \u6587\u4ef6\u540d\u4ee5<font color=red>`test`</font>\u5f00\u59cb\u6216\u8005\u7ed3\u5c3e\u4f1a\u6253\u5370sql\u6267\u884c\u7684\u6b65\u9aa4;\n        * `ehandling`: sql\u6267\u884c\u51fa\u9519\u7684\u65f6\u5019\u5904\u7406\u65b9\u5f0f, default: None\n        * `verbose`: \u6267\u884c\u7684\u8fdb\u5ea6\u5c55\u793a\u65b9\u5f0f\uff080\uff1a\u4e0d\u6253\u5370\uff0c 1\uff1a\u6587\u5b57\u8fdb\u5ea6\uff0c 2\uff1a\u8fdb\u5ea6\u6761\uff09\n        * `kw`\uff1a sql\u6587\u4ef6\u4e2d\u9700\u8981\u66ff\u6362\u7684\u53c2\u6570 \u5728sql\u6587\u4ef6\u4e2d\u7528`$param`, \u4f1a\u66ff\u6362sqlfile\u4e2d\u7684arguments;\n    + sql\u6587\u4ef6\u683c\u5f0f(\u5728desc\u4e2d\u589e\u52a0<font color=red>`verbose`</font>\u4f1a\u6253\u5370sql\u6267\u884c\u7684\u6b65\u9aa4;)\n        ```sql\n        #\u3010arguments\u3011#\n        ts = '2020-06-28'\n        date = today\n        date_max = date + timedelta(days=10)\n        #\u3010arguments\u3011#\n        ###\n        --\u3010desc1 [verbose]\u3011 #sql\u63cf\u8ff0\n        --step1\n        sql1;\n        --step2\n        sql2 where name = $name;\n        ###\n        ###\n        --\u3010desc2 [verbose]\u3011 #sql\u63cf\u8ff0\n        --step1\n        sql1;\n        --step2\n        sql2;\n        ###\n        ```\n    + arguments\n        * \u652f\u6301python\u8868\u8fbe\u5f0f\uff08datetime\u3001date\u3001timedelta\uff09\n        * \u652f\u6301\u5168\u5c40\u53d8\u91cf\u548c\u5f53\u524dsqlfile\u8bbe\u7f6e\u8fc7\u7684\u53d8\u91cf\n        * now\uff1a\u83b7\u53d6\u6267\u884c\u7684\u65f6\u95f4\n        * today: \u83b7\u53d6\u6267\u884c\u7684\u65e5\u671f\n\n## \u9b54\u6cd5\u547d\u4ee4\n+ \u6ce8\u518c\u65b9\u6cd5  \n\u547d\u4ee4\u884c\u4e2d\u6267\u884c`pydbapimagic`\n\n+ \u53c2\u6570\n    * \u5e2e\u52a9  \n    `%dbconfig`\n    * \u914d\u7f6e  \n        ```python\n        %dbconfig DBTYPE = 'mysql'\n        %dbconfig HOST = 'localhost'\n        %dbconfig USER = 'longfengpili'\n        %dbconfig PASSWORD = '123456abc'\n        %dbconfig DATABASE = 'test'\n        %dbconfig PORT = 3306\n        ```\n    * \u67e5\u770b  \n    `%dbconfig DBTYPE`\n\n## \u652f\u6301\u7684\u7684settings[\u3010conf/settings.py\u3011](https://github.com/longfengpili/pydbapi/blob/master/pydbapi/conf/logconf.py)\n+ AUTO_RULES  \n    \u53ef\u4ee5\u81ea\u52a8\u6267\u884c\u8868\u540d\uff08\u8868\u540d\u5305\u542b\u5373\u53ef\uff09\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A simple database API",
    "version": "0.0.138",
    "project_urls": {
        "Documentation": "https://github.com/longfengpili/pydbapi/blob/master/README.md",
        "Homepage": "https://pypi.org/project/pydbapi/",
        "Source": "https://github.com/longfengpili/pydbapi"
    },
    "split_keywords": [
        "dbapi",
        " sqlite3",
        " redshift",
        " snowflake",
        " doris",
        " trino"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6e6eb970ae7a79ec7918264f4f7f9cb6f796ea20681943678929f34ffe408de6",
                "md5": "2fdee354ec966b067f9f16722b25b618",
                "sha256": "921564debb32d220263171fdc876df05e266d9c1c2c7acf32efc738ba25a8c32"
            },
            "downloads": -1,
            "filename": "pydbapi-0.0.138-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2fdee354ec966b067f9f16722b25b618",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 37603,
            "upload_time": "2024-11-21T08:07:04",
            "upload_time_iso_8601": "2024-11-21T08:07:04.182911Z",
            "url": "https://files.pythonhosted.org/packages/6e/6e/b970ae7a79ec7918264f4f7f9cb6f796ea20681943678929f34ffe408de6/pydbapi-0.0.138-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ce54d0e8bb6854695b33e3f39b594ad292b278c6e2c3a4a70d309ac23adb12be",
                "md5": "00e14bb54f81f5772c6ab983230e4ade",
                "sha256": "cbdb0d919e297955706180f2582f5469078bcc69bea9dbc31a0218a3ff059694"
            },
            "downloads": -1,
            "filename": "pydbapi-0.0.138.tar.gz",
            "has_sig": false,
            "md5_digest": "00e14bb54f81f5772c6ab983230e4ade",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 30161,
            "upload_time": "2024-11-21T08:07:05",
            "upload_time_iso_8601": "2024-11-21T08:07:05.570735Z",
            "url": "https://files.pythonhosted.org/packages/ce/54/d0e8bb6854695b33e3f39b594ad292b278c6e2c3a4a70d309ac23adb12be/pydbapi-0.0.138.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-21 08:07:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "longfengpili",
    "github_project": "pydbapi",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "pydbapi"
}
        
Elapsed time: 0.43478s