Power BI Desktop 中的数据源Data sources in Power BI Desktop

使用 Power BI Desktop,你可以连接到来自许多不同的源的数据。With Power BI Desktop, you can connect to data from many different sources. 有关可用数据源的完整列表,请参阅 Power BI 数据源For a full list of available data sources, see Power BI data sources.

你可以使用“主页”功能区连接到数据。You connect to data by using the Home ribbon. 若要显示“最常用”数据类型菜单,请选择“获取数据”按钮标签或向下箭头。To show the Most Common data types menu, select the Get Data button label or the down arrow.

Power BI Desktop 中的“最常用”数据类型菜单、“获取数据”

转到“获取数据”对话框,显示“最常用”数据类型菜单,然后选择“更多”。To go to the Get Data dialog box, show the Most Common data types menu and select More. 你还可以通过直接选择“获取数据”图标来打开“获取数据”对话框(绕过“最常用”菜单) 。You can also bring up the Get Data dialog box (and bypass the Most Common menu) by selecting the Get Data icon directly.

“获取数据”按钮、Power BI Desktop

备注

Power BI 团队正在不断扩展适用于 Power BI Desktop 和 Power BI 服务的数据源。The Power BI team is continually expanding the data sources available to Power BI Desktop and the Power BI service. 因此,你通常会看到工作过程中的数据源版本标记为 Beta预览As such, you'll often see early versions of work-in-progress data sources marked as Beta or Preview. 标记为 Beta 或预览的任何数据源所提供的支持和功能有限,不应在生产环境中使用。Any data source marked as Beta or Preview has limited support and functionality, and it shouldn't be used in production environments. 此外,任何标记为 Power BI Desktop Beta 或预览版的数据源在数据源正式发布 (GA) 之前可能都无法在 Power BI 服务或其他 Microsoft 服务中使用 。Additionally, any data source marked as Beta or Preview for Power BI Desktop may not be available for use in the Power BI service or other Microsoft services until the data source becomes generally available (GA).

备注

Power BI Desktop 中的许多数据连接器都需要 Internet Explorer 10(或更高版本)进行身份验证。There are many data connectors for Power BI Desktop that require Internet Explorer 10 (or newer) for authentication.

数据源Data sources

“获取数据”对话框按以下类别组织数据类型:The Get Data dialog box organizes data types in the following categories:

  • 全部All
  • 文件File
  • 数据库Database
  • Power PlatformPower Platform
  • AzureAzure
  • Online ServicesOnline Services
  • 其他Other

全部类别包括来自所有类别的所有数据连接类型。The All category includes all data connection types from all categories.

文件数据源File data sources

文件类别提供下列数据连接:The File category provides the following data connections:

  • ExcelExcel
  • 文本/CSVText/CSV
  • XMLXML
  • JSONJSON
  • 文件夹Folder
  • PDFPDF
  • SharePoint 文件夹SharePoint folder

下图显示文件获取数据窗口。The following image shows the Get Data window for File.

文件数据源、“获取数据”对话框、Power BI Desktop

数据库数据源Database data sources

数据库类别提供下列数据连接:The Database category provides the following data connections:

  • SQL Server 数据库SQL Server database
  • Access 数据库Access database
  • SQL Server Analysis Services 数据库SQL Server Analysis Services database
  • Oracle 数据库Oracle database
  • IBM DB2 数据库IBM DB2 database
  • IBM Informix 数据库 (Beta)IBM Informix database (Beta)
  • IBM NetezzaIBM Netezza
  • MySQL 数据库MySQL database
  • PostgreSQL 数据库PostgreSQL database
  • Sybase 数据库Sybase database
  • Teradata 数据库Teradata database
  • SAP HANA 数据库SAP HANA database
  • SAP Business Warehouse 应用程序服务器SAP Business Warehouse Application Server
  • SAP Business Warehouse 消息服务器SAP Business Warehouse Message Server
  • Amazon RedshiftAmazon Redshift
  • ImpalaImpala
  • Google BigQueryGoogle BigQuery
  • VerticaVertica
  • SnowflakeSnowflake
  • EssbaseEssbase
  • AtScale 多维数据集AtScale cubes
  • BI 连接器BI Connector
  • Data Virtuality LDW (Beta)Data Virtuality LDW (Beta)
  • DenodoDenodo
  • DremioDremio
  • ExasolExasol
  • Indexima (Beta)Indexima (Beta)
  • InterSystems IRIS (Beta)InterSystems IRIS (Beta)
  • Jethro (Beta)Jethro (Beta)
  • KyligenceKyligence
  • Linkar PICK 样式/多值数据库 (Beta)Linkar PICK Style / MultiValue Databases (Beta)
  • MarkLogicMarkLogic

备注

某些数据库连接器需要通过选择“文件”>“选项和设置”>“选项”,然后再选择“预览功能”才能启用 。Some database connectors require that you enable them by selecting File > Options and settings > Options then selecting Preview Features and enabling the connector. 如果你没有看到上面提到的某些连接器,但想使用它们,请检查“预览功能”设置。If you don't see some of the connectors mentioned above and want to use them, check your Preview Features settings. 另请注意,标记为 Beta预览的任何数据源所提供的支持和功能有限,不应在生产环境中使用。Also note that any data source marked as Beta or Preview has limited support and functionality, and should not be used in production environments.

下图显示数据库获取数据窗口。The following image shows the Get Data window for Database.

数据库数据源、“获取数据”对话框、Power BI Desktop

Power Platform 数据源Power Platform data sources

“Power 平台”类别提供下列数据连接:The Power Platform category provides the following data connections:

  • Power BI 数据集Power BI datasets
  • Power BI 数据流Power BI dataflows
  • Common Data ServiceCommon Data Service
  • Power Platform 数据流Power Platform dataflows

下图显示 Power 平台的“获取数据”窗口 。The following image shows the Get Data window for Power Platform.

Power Platform 数据源、“获取数据”对话框、Power BI Desktop

Azure 数据源Azure data sources

Azure 类别提供下列数据连接:The Azure category provides the following data connections:

  • Azure SQL 数据库Azure SQL Database
  • Azure SQL 数据仓库Azure SQL Data Warehouse
  • Azure Analysis Services 数据库Azure Analysis Services database
  • Azure Database for PostgreSQLAzure Database for PostgreSQL
  • Azure Blob 存储Azure Blob Storage
  • Azure 表存储Azure Table Storage
  • Azure Cosmos DBAzure Cosmos DB
  • Azure Data Lake Storage Gen2Azure Data Lake Storage Gen2
  • Azure Data Lake Storage Gen1Azure Data Lake Storage Gen1
  • Azure HDInsight (HDFS)Azure HDInsight (HDFS)
  • Azure HDInsight SparkAzure HDInsight Spark
  • HDInsight 交互式查询HDInsight Interactive Query
  • Azure 数据资源管理器 (Kusto)Azure Data Explorer (Kusto)
  • Azure 成本管理Azure Cost Management
  • Azure 时序见解 (Beta)Azure Time Series Insights (Beta)

下图显示 Azure获取数据窗口。The following image shows the Get Data window for Azure.

Azure 数据源、“获取数据”对话框、Power BI Desktop

联机服务数据源Online Services data sources

Online Services 类别提供下列数据连接:The Online Services category provides the following data connections:

  • SharePoint Online 列表SharePoint Online List
  • Microsoft Exchange OnlineMicrosoft Exchange Online
  • Dynamics 365 (联机)Dynamics 365 (online)
  • Dynamics NAVDynamics NAV
  • Dynamics 365 Business CentralDynamics 365 Business Central
  • Dynamics 365 Business Central (本地)Dynamics 365 Business Central (on-premises)
  • Microsoft Azure 使用见解(Beta)Microsoft Azure Consumption Insights (Beta)
  • Azure DevOps(仅 Boards)Azure DevOps (Boards only)
  • Azure DevOps Server(仅 Boards)Azure DevOps Server (Boards only)
  • Salesforce 对象Salesforce Objects
  • Salesforce 报表Salesforce Reports
  • Google AnalyticsGoogle Analytics
  • Adobe AnalyticsAdobe Analytics
  • appFigures (Beta)appFigures (Beta)
  • Data.World - 获取数据集 (Beta)Data.World - Get Dataset (Beta)
  • GitHub (Beta)GitHub (Beta)
  • LinkedIn Sales Navigator (Beta)LinkedIn Sales Navigator (Beta)
  • Marketo (Beta)Marketo (Beta)
  • Mixpanel (Beta)Mixpanel (Beta)
  • Planview Enterprise One - PRM (Beta)Planview Enterprise One - PRM (Beta)
  • Planview Projectplace (Beta)Planview Projectplace (Beta)
  • QuickBooks Online (Beta)QuickBooks Online (Beta)
  • SmartsheetSmartsheet
  • SparkPost (Beta)SparkPost (Beta)
  • SweetIQ (Beta)SweetIQ (Beta)
  • Planview Enterprise One - CTM (Beta)Planview Enterprise One - CTM (Beta)
  • Twilio (Beta)Twilio (Beta)
  • tyGraph (Beta)tyGraph (Beta)
  • Webtrends (Beta)Webtrends (Beta)
  • Zendesk (Beta)Zendesk (Beta)
  • Asana (Beta)Asana (Beta)
  • Dynamics 365 Customer Insights (Beta)Dynamics 365 Customer Insights (Beta)
  • Emigo Data SourceEmigo Data Source
  • Entersoft Business Suite (Beta)Entersoft Business Suite (Beta)
  • FactSet Analytics (Beta)FactSet Analytics (Beta)
  • Industrial App StoreIndustrial App Store
  • Intune 数据仓库 (Beta)Intune Data Warehouse (Beta)
  • Microsoft Graph Security (Beta)Microsoft Graph Security (Beta)
  • 适用于 Power BI 的 Projectplace (Beta)Projectplace for Power BI (Beta)
  • 产品见解 (Beta)Product Insights (beta)
  • Quick BaseQuick Base
  • TeamDesk (Beta)TeamDesk (Beta)
  • Webtrends Analytics (Beta)Webtrends Analytics (Beta)
  • Witivio (Beta)Witivio (Beta)
  • Workplace Analytics (Beta)Workplace Analytics (Beta)
  • Zoho Creator (Beta)Zoho Creator (Beta)

下图显示 Online Services获取数据窗口。The following image shows the Get Data window for Online Services.

联机服务数据源、“获取数据”对话框、Power BI Desktop

其他数据源Other data sources

其他类别提供下列数据连接:The Other category provides the following data connections:

  • WebWeb
  • SharePoint 列表SharePoint list
  • OData 数据源OData Feed
  • Active DirectoryActive Directory
  • Microsoft ExchangeMicrosoft Exchange
  • Hadoop 文件 (HDFS)Hadoop File (HDFS)
  • SparkSpark
  • Hive LLAP (Beta)Hive LLAP (Beta)
  • R 脚本R script
  • Python 脚本Python script
  • ODBCODBC
  • OLE DBOLE DB
  • 解算器Solver
  • Cognite Data Fusion (Beta)Cognite Data Fusion (Beta)
  • FHIRFHIR
  • Information Grid (Beta)Information Grid (Beta)
  • Jamf Pro (Beta)Jamf Pro (Beta)
  • 适用于 Power BI 的 MicroStrategyMicroStrategy for Power BI
  • PaxataPaxata
  • QubolePresto (Beta)QubolePresto (Beta)
  • Roamler (Beta)Roamler (Beta)
  • Shortcuts Business Insights (Beta)Shortcuts Business Insights (Beta)
  • SiteimproveSiteimprove
  • SurveyMonkey (Beta)SurveyMonkey (Beta)
  • Tenforce (Smart)ListTenforce (Smart)List
  • TIBCO(R) 数据虚拟化 (Beta)TIBCO(R) Data Virtualization (Beta)
  • Vena (Beta)Vena (Beta)
  • 工作人员维度 (Beta)Workforce Dimensions (Beta)
  • Zucchetti HR Infinity (Beta)Zucchetti HR Infinity (Beta)
  • 空白查询Blank Query

下图显示其他获取数据窗口。The following image shows the Get Data window for Other.

其他数据源、“获取数据”对话框、Power BI Desktop

备注

此时,无法连接到使用 Azure Active Directory 保护的自定义数据源。At this time, it's not possible to connect to custom data sources secured using Azure Active Directory.

连接到数据源Connecting to a data source

若要连接到数据源,请从获取数据窗口选择数据源,然后选择连接To connect to a data source, select the data source from the Get Data window and select Connect. 在下图中,已从其他数据连接类别中选择了 WebIn the following image, Web is selected from the Other data connection category.

连接到 Web、“获取数据”对话框、Power BI Desktop

将显示特定于数据连接类型的连接窗口。A connection window is displayed, specific to the type of data connection. 如果需要提供凭据,将提示你提供凭据。If credentials are required, you’ll be prompted to provide them. 下图显示输入 URL 以便连接到 Web 数据源。The following image shows a URL being entered to connect to a Web data source.

输入 URL、“从 Web”对话框、Power BI Desktop

输入 URL 或资源连接信息,然后选择“确定”。Enter the URL or resource connection information, and then select OK. Power BI Desktop 会建立到数据源的连接,并在“导航器”中显示可用的数据源。Power BI Desktop makes the connection to the data source, and it presents the available data sources in the Navigator.

“导航器”对话框,Power BI Desktop

若要加载数据,请在“导航器”窗格底部选择“加载”按钮 。To load the data, select the Load button at the bottom of the Navigator pane. 若要在加载数据之前在 Power Query 编辑器中转换或编辑查询,请选择“转换数据”按钮。To transform or edit the query in Power Query Editor before loading the data, select the Transform Data button.

这就是连接到 Power BI Desktop 中的数据源的所有相关信息!That’s all there is to connecting to data sources in Power BI Desktop! 尝试从我们不断增多的数据源列表连接到数据,并经常回访 - 我们会持续将数据源添加到此列表中。Try connecting to data from our growing list of data sources, and check back often - we continue to add to this list all the time.

使用 PBIDS 文件获取数据Using PBIDS files to get data

PBIDS 文件是具有特定结构的 Power BI Desktop 文件,并且具有 .PBIDS 扩展名,用于标识它是 Power BI 数据源文件。PBIDS files are Power BI Desktop files that have a specific structure, and they have a .PBIDS extension to identify it is a Power BI data source file.

可以创建 PBIDS 文件,用于简化组织中报表创建者的“获取数据”体验。You can create a PBIDS file to streamline the Get Data experience for report creators in your organization. 为了使新的报表作者更容易使用 PBIDS 文件,我们建议管理员为常用连接创建这些文件。To make it easier for a new report author to use PBIDS files, we recommend that an administrator create these files for commonly used connections.

当作者打开 PBIDS 文件时,Power BI Desktop 将打开并提示用户提供凭据,以进行身份验证并连接到文件中指定的数据源。When an author opens a PBIDS file, Power BI Desktop opens and prompts the user for credentials to authenticate and connect to the data source that's specified in the file. 此时将显示“导航”对话框,用户必须从该数据源中选择要加载到模型中的表。The Navigation dialog box appears, and the user must select the tables from that data source to load into the model. 如果未在 PBIDS 文件中指定数据库,用户可能还需要选择数据库。Users may also need to select the database(s) if none was specified in the PBIDS file.

之后,用户便可以开始生成可视化效果,或选择“最近使用的源”,将一组新的表加载到模型中。From that point forward, the user can begin building visualizations or select Recent Sources to load a new set of tables into the model.

目前,PBIDS 文件仅支持一个文件中的单个数据源。Currently, PBIDS files only support a single data source in one file. 指定多个数据源会导致错误。Specifying more than one data source results in an error.

若要创建 PBIDS 文件,管理员必须为单一连接指定所需的输入。To create the PBIDS file, an administrator must specify the required inputs for a single connection. 他们还可以将连接模式指定为“DirectQuery”或“导入”。They can also specify the connection mode as either DirectQuery or Import. 如果文件中缺少“模式”或者为 null,系统会提示在 Power BI Desktop 中打开文件的用户选择“DirectQuery”或“导入”。If mode is missing/null in the file, the user who opens the file in Power BI Desktop is prompted to select DirectQuery or Import.

PBIDS 文件示例PBIDS file examples

本节提供了一些来自常用数据源的示例。This section provides some examples from commonly used data sources. PBIDS 文件类型仅支持在 Power BI Desktop 中同时支持的数据连接,但有两个例外:“实时连接”和“空白查询”。The PBIDS file type only supports data connections that are also supported in Power BI Desktop, with two exceptions: Live Connect and Blank Query.

PBIDS 文件不包括身份验证信息以及表和架构信息。The PBIDS file doesn't include authentication information and table and schema information.

以下代码片段显示了 PBIDS 文件的几个常见示例,但是它们并不完整,也不全面。The following code snippets show several common examples for PBIDS files, but they aren't complete or comprehensive. 对于其他数据源,可以参阅协议和地址信息的数据源引用 (DSR) 格式For other data sources, you can refer to the Data Source Reference (DSR) format for protocol and address information.

这些示例只是为了方便起见,并不全面,也不包含 DSR 格式的所有受支持的连接器。These examples are for convenience only, aren't meant to be comprehensive, and don't include all supported connectors in DSR format. 管理员或组织可以使用这些示例作为指南来创建自己的数据源,从而创建和支持自己的数据源文件。An administrator or organization can create their own data sources using these examples as guides, from which they can create and support their own data source files.

Azure ASAzure AS

{ 
    "version": "0.1", 
    "connections": [ 
    { 
        "details": { 
        "protocol": "analysis-services", 
        "address": { 
            "server": "server-here" 
        }, 
        } 
    } 
    ] 
}

文件夹Folder

{ 
  "version": "0.1", 
  "connections": [ 
    { 
      "details": { 
        "protocol": "folder", 
        "address": { 
            "path": "folder-path-here" 
        } 
      } 
    } 
  ] 
} 

ODataOData

{ 
  "version": "0.1", 
  "connections": [ 
    { 
      "details": { 
        "protocol": "odata", 
        "address": { 
            "url": "URL-here" 
        } 
      } 
    } 
  ] 
} 

SAP BWSAP BW

{ 
  "version": "0.1", 
  "connections": [ 
    { 
      "details": { 
        "protocol": "sap-bw-olap", 
        "address": { 
          "server": "server-name-here", 
          "systemNumber": "system-number-here", 
          "clientId": "client-id-here" 
        }, 
      } 
    } 
  ] 
} 

SAP HanaSAP Hana

{ 
  "version": "0.1", 
  "connections": [ 
    { 
      "details": { 
        "protocol": "sap-hana-sql", 
        "address": { 
          "server": "server-name-here:port-here" 
        }, 
      } 
    } 
  ] 
} 

SharePoint 列表SharePoint list

URL 必须指向 SharePoint 站点本身,而不是站点内的列表。The URL must point to the SharePoint site itself, not to a list within the site. 用户将获取一个导航器,并用该导航器从该站点选择一个或多个列表,其中每个列表都成为模型中的一个表。Users get a navigator that allows them to select one or more lists from that site, each of which becomes a table in the model.

{ 
  "version": "0.1", 
  "connections": [ 
    { 
      "details": { 
        "protocol": "sharepoint-list", 
        "address": { 
          "url": "URL-here" 
        }, 
       } 
    } 
  ] 
} 

SQL ServerSQL Server

{ 
  "version": "0.1", 
  "connections": [ 
    { 
      "details": { 
        "protocol": "tds", 
        "address": { 
          "server": "server-name-here", 
          "database": "db-name-here (optional) "
        } 
      }, 
      "options": {}, 
      "mode": "DirectQuery" 
    } 
  ] 
} 

文本文件Text file

{ 
  "version": "0.1", 
  "connections": [ 
    { 
      "details": { 
        "protocol": "file", 
        "address": { 
            "path": "path-here" 
        } 
      } 
    } 
  ] 
} 

WebWeb

{ 
  "version": "0.1", 
  "connections": [ 
    { 
      "details": { 
        "protocol": "http", 
        "address": { 
            "url": "URL-here" 
        } 
      } 
    } 
  ] 
} 

数据流Dataflow

{
  "version": "0.1",
  "connections": [
    {
      "details": {
        "protocol": "powerbi-dataflows",
        "address": {
          "workspace":"workspace id (Guid)",
          "dataflow":"optional dataflow id (Guid)",
          "entity":"optional entity name"
        }
       }
    }
  ]
}

后续步骤Next steps

可以使用 Power BI Desktop 执行各种操作。You can do all sorts of things with Power BI Desktop. 有关其功能的详细信息,请参阅下列资源:For more information on its capabilities, check out the following resources: