You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
529 B
26 lines
529 B
2 years ago
|
#!/usr/bin/env python
|
||
|
# -*- coding: utf-8 -*-
|
||
|
# @Time : 2023/4/4 16:04
|
||
|
# @Author : old tom
|
||
|
# @File : abs_connector.py
|
||
|
# @Project : futool-db
|
||
|
# @Desc : 抽象层
|
||
|
|
||
|
import abc
|
||
|
from sqlalchemy import create_engine
|
||
|
|
||
|
|
||
|
class CommonConnector(metaclass=abc.ABCMeta):
|
||
|
|
||
|
def __init__(self, db_conf: str):
|
||
|
# 初始化
|
||
|
self.engine = create_engine(db_conf, pool_size=15, pool_recycle=3600)
|
||
|
|
||
|
@abc.abstractmethod
|
||
|
def get_conn(self):
|
||
|
"""
|
||
|
获取连接
|
||
|
:return:
|
||
|
"""
|
||
|
pass
|