Only import sqlite3 when type checking
Fixes: #7127 Signed-off-by: David Vo <david@vovo.id.au>
This commit is contained in:
parent
b5d0b038f4
commit
5bd2b27525
|
@ -0,0 +1 @@
|
||||||
|
Avoid importing `sqlite3` when using the postgres backend. Contributed by David Vo.
|
|
@ -12,14 +12,17 @@
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
import sqlite3
|
|
||||||
import struct
|
import struct
|
||||||
import threading
|
import threading
|
||||||
|
import typing
|
||||||
|
|
||||||
from synapse.storage.engines import BaseDatabaseEngine
|
from synapse.storage.engines import BaseDatabaseEngine
|
||||||
|
|
||||||
|
if typing.TYPE_CHECKING:
|
||||||
|
import sqlite3 # noqa: F401
|
||||||
|
|
||||||
class Sqlite3Engine(BaseDatabaseEngine[sqlite3.Connection]):
|
|
||||||
|
class Sqlite3Engine(BaseDatabaseEngine["sqlite3.Connection"]):
|
||||||
def __init__(self, database_module, database_config):
|
def __init__(self, database_module, database_config):
|
||||||
super().__init__(database_module, database_config)
|
super().__init__(database_module, database_config)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue