如何使用脚本检查MS SQL Server运行或存在。 我下面有脚本,对脚本不满意,是否有任何明智的查找方法?
from sqlalchemy import create_engine
from sqlalchemy import inspect
MSSQL_ServerName = 'DESKTOP-R27RCUDD'
try:
Driver = 'driver=SQL Server Native Client 11.0';
engine = create_engine('mssql+pyodbc://' + MSSQL_ServerName + '/master?' + Driver)
Inspector = inspect(engine)
except:
print('SQL Server NOT Found')