Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Only import sqlite3 when type checking #7155

Merged
merged 1 commit into from
Mar 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/7155.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Avoid importing `sqlite3` when using the postgres backend. Contributed by David Vo.
7 changes: 5 additions & 2 deletions synapse/storage/engines/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import sqlite3
import struct
import threading
import typing

from synapse.storage.engines import BaseDatabaseEngine

if typing.TYPE_CHECKING:
richvdh marked this conversation as resolved.
Show resolved Hide resolved
import sqlite3 # noqa: F401

class Sqlite3Engine(BaseDatabaseEngine[sqlite3.Connection]):

class Sqlite3Engine(BaseDatabaseEngine["sqlite3.Connection"]):
def __init__(self, database_module, database_config):
super().__init__(database_module, database_config)

Expand Down