如何将 Microsoft SQL Server 数据库连接到 Open Data Discovery(奇数平台)?

问题描述 投票:0回答:1

我正在尝试将我的 SQL Server 数据库连接到开放数据发现 (ODD) 平台。以下是我到目前为止所遵循的步骤:

  1. 我按照此指南使用 Azure Data Studio 部署了 SQL Server 数据库。

  2. 我创建了数据库: `创建数据库 BikeStores;

  3. 我根据此教程创建了表格并加载了数据。

  4. 我使用以下查询检查了 IP 和端口:` Azure Data Studio

  5. 我使用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}')

输出是:

enter image description here

  1. 按照 ODD 设置指南,我克隆了 ODD 平台存储库:

git clone https://github.com/opendatadiscovery/odd-platform

cd odd-platform

docker-compose -f docker/demo.yaml up -d odd-platform-enricher

  1. 我在
    http://localhost:8080/management/datasources
    处打开了ODD接口,然后在
    http://localhost:8080/management/collectors
    处添加了一个收集器:

enter image description here

  1. 我复制了令牌并将其粘贴到 odd-platform/docker/config/collector_config.yaml 文件中,如下所示:

enter image description here

  1. 我使用以下命令启动了收集器:

docker-compose -f docker/demo.yaml up -d odd-collector 

  1. 尝试重新启动收集器几次:

docker-compose -f docker/demo.yaml restart odd-collector

问题:

ODD平台未检测到连接的数据库,数据未加载。我错过了哪些步骤或做得不正确?

sql-server azure
1个回答
0
投票

我通过更改 IP 地址 (172.18.0.1) 解决了我的问题 enter image description here 并更新

collector_config.yaml
文件。 enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.