Last active
July 21, 2020 06:06
-
-
Save BexTuychiev/f8a6cd7fd6b46d0657195757f3e7a265 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sqlalchemy import create_engine | |
# create an engine | |
engine = create_engine("sqlite:///sample.db") | |
try: | |
# Establish a connection | |
connection = engine.connect() | |
print('Connection successful!') | |
except Exception as error: | |
print("Something is wrong. Getting this error:\n", error) | |
finally: | |
connection.close() | |
print('Connection closed!') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment