我正在尝试将我的 SQL Server 数据库连接到开放数据发现 (ODD) 平台。以下是我到目前为止所遵循的步骤:
我按照此指南使用 Azure Data Studio 部署了 SQL Server 数据库。
我创建了数据库: `创建数据库 BikeStores;
我根据此教程创建了表格并加载了数据。
我使用Python验证了与数据库的连接:
import pyodbc
# Connection parameters
server = 'localhost'
database = 'BikeStores'
username = 'sa'
password = 'my_password'
# Connection string
conn_str = (
f'DRIVER={{ODBC Driver 17 for SQL Server}};'
f'SERVER={server};'
f'DATABASE={database};'
f'UID={username};'
f'PWD={password}'
)
try:
# Connect to the database
with pyodbc.connect(conn_str) as conn:
cursor = conn.cursor()
# Query to get table names
query = """
SELECT TABLE_SCHEMA, TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'
"""
cursor.execute(query)
# Fetch the data
tables = cursor.fetchall()
# Output the table names
for table in tables:
schema, name = table
print(f'{schema}.{name}')
except pyodbc.Error as e:
print(f'Connection error: {e}')
输出是:
git clone https://github.com/opendatadiscovery/odd-platform
cd odd-platform
docker-compose -f docker/demo.yaml up -d odd-platform-enricher
http://localhost:8080/management/datasources
处打开了ODD接口,然后在http://localhost:8080/management/collectors
处添加了一个收集器:docker-compose -f docker/demo.yaml up -d odd-collector
docker-compose -f docker/demo.yaml restart odd-collector
ODD平台未检测到连接的数据库,数据未加载。我错过了哪些步骤或做得不正确?