Ошибка ole db или odbc ключу не соответствует

 

sokol92

Пользователь

Сообщений: 4456
Регистрация: 10.09.2017

#6

02.07.2020 14:50:10

Может быть, источники данных находятся на Вашем личном диске или на сетевом диске, к которому не все пользователи файла из #1 (PQ файл) имеют доступ. Надо выложить все исходные файлы на сетевой ресурс, доступный пользователям PQ файла, и изменить путь к источникам данных в PQ файле.
Зайдите на проблемный компьютер и попробуйте изменить запрос — сразу всё увидите.

Изменено: sokol9202.07.2020 14:56:47

Владимир

I figured out the cause of my problem and the solution. The issue is that the row in my template query was being referenced incorrectly (i.e., the primary key between the template query and the regular query is wrong, and it has hard-coding of sheet names). To fix that, I had to remove all other columns in the template query table except the Data column, as described here. (It’s odd that no MS documentation on combining multiple Excel files discusses this very important step.)

For comparison, here is my former (incorrect) M code:

Transform Sample File:

let
    Source = Excel.Workbook(Parameter1, null, true),
    #"Sample_Sheet" = Source{[Item="sample",Kind="Sheet"]}[Data],
    #"Promoted Headers" = Table.PromoteHeaders(#"Sample_Sheet", [PromoteAllScalars=true])
in
    #"Promoted Headers"

test:

let
    Source = Folder.Files("C:some folder path"),
    #"Filtered Hidden Files1" = Table.SelectRows(Source, each [Attributes]?[Hidden]? <> true),
    #"Invoke Custom Function1" = Table.AddColumn(#"Filtered Hidden Files1", "Transform File", each #"Transform File"([Content])),
    #"Renamed Columns1" = Table.RenameColumns(#"Invoke Custom Function1", {"Name", "Source.Name"}),
    #"Removed Other Columns1" = Table.SelectColumns(#"Renamed Columns1", {"Source.Name", "Transform File"}),
    #"Expanded Table Column1" = Table.ExpandTableColumn(#"Removed Other Columns1", "Transform File", Table.ColumnNames(#"Transform File"(#"Sample File"))),
    #"Changed Type" = Table.TransformColumnTypes(#"Expanded Table Column1",{{"Source.Name", type text}, {"ID", type text}, {"Name", type text}})
in
    #"Changed Type"

And here is my new (correct) code:

Transform Sample File:

let
    Source = Excel.Workbook(Parameter1, null, true),
    #"Removed Columns" = Table.RemoveColumns(Source,{"Name", "Item", "Kind", "Hidden"}),
    Data = #"Removed Columns"{0}[Data],
    #"Promoted Headers" = Table.PromoteHeaders(Data, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"ID", type text}, {"Name", type text}})
in
    #"Changed Type"

test:

let
    Source = Folder.Files("C:some folder path"),
    #"Filtered Hidden Files1" = Table.SelectRows(Source, each [Attributes]?[Hidden]? <> true),
    #"Invoke Custom Function1" = Table.AddColumn(#"Filtered Hidden Files1", "Transform File", each #"Transform File"([Content])),
    #"Renamed Columns1" = Table.RenameColumns(#"Invoke Custom Function1", {"Name", "Source.Name"}),
    #"Removed Other Columns1" = Table.SelectColumns(#"Renamed Columns1", {"Source.Name", "Transform File"}),
    #"Expanded Table Column1" = Table.ExpandTableColumn(#"Removed Other Columns1", "Transform File", Table.ColumnNames(#"Transform File"(#"Sample File")))
in
    #"Expanded Table Column1"

Notice the ‘Removed Columns’ step in the new template query. This is the «secret sauce» to the key problem. Also notice that I kept all default steps after my ‘Data’ step (i.e., ‘Promoted Headers’ and ‘Changed Type’) in my template query. This is because all of my sheets have the same schema. If this weren’t true, then I would need to move those steps to the regular query.

Обработка ошибок в Power Query с помощью попытки в противном случае — советы и рекомендации по Power BI №32

Я пытаюсь загрузить (объединить) несколько файлов Excel в Power BI (версия от октября 2019 г.). В каждом файле всего 1 лист. Каждый лист имеет 1 диапазон, и каждый диапазон имеет одинаковую схему для всех файлов. (Хотя названия листов разные.) Имя образца листа — «200704».

Вот мои шаги:

  1. Получить данные папку подключить
  2. укажите путь к папке
  3. Объединить и загрузить
  4. выберите один из файлов в качестве моего файла образца; щелкните имя файла как мой Параметр1; нажмите ОК

После того, как я нажму «ОК», курсор немного покрутится, а затем остановится. Ничего не произошло. Итак, я перехожу в Edit Queries Edit Queries. В моем запросе данных есть предупреждающий символ, который гласит:

Произошла ошибка в запросе «Преобразовать файл». Expression.Error: ключ не соответствует ни одной строке в таблице.

Подробности: Ключ = Элемент = 200704 Вид = Лист Таблица = [Таблица]

Как мне исправить эту ошибку?

Если это поможет, Power BI сгенерирует для меня 5 запросов со следующей структурой:

  • Преобразовать файл из данных [2]
  • Вспомогательные запросы [3]
  • Параметр1 (образец файла)
  • Образец файла
  • Преобразовать файл
  • Файл-образец преобразования
  • Другие запросы [1]
  • данные

Интересно, что если это помогает диагностировать проблему, если я установил образец файла = Первый файл или если я вручную установил образец файла для своего первого файла, в диалоговом окне выдается следующая ошибка, но она не показывает, какой запрос ошибочен. когда я пытаюсь просмотреть / отредактировать запрос.

Не удалось сохранить изменения на сервере. Возвращена ошибка: «Ошибка OLE DB или ODBC: [Expression.Error] Ключ не соответствует ни одной строке в таблице ..».

И, конечно же, когда я пытаюсь загрузить этот файл (или любой файл в папке, если на то пошло) индивидуально (через соединение с Excel), он загружается успешно. Итак, что-то должно быть не так с кодом M в моем подключении к папке.

  • Вы пытались выяснить, есть ли что-нибудь в вашем 200704 лист отличается от любых других листов в папке? Структура, форматирование и т. Д.

Я выяснил причину своей проблемы и решение. Проблема в том, что на строку в моем запросе шаблона ссылались неправильно (т.е. первичный ключ между запросом шаблона и обычным запросом неверен, и в нем жестко заданы имена листов). Чтобы исправить это, мне пришлось удалить все другие столбцы в таблице запроса шаблона, кроме столбца данных, как описано здесь. (Странно, что никакой документации MS по объединению нескольких файлов Excel не обсуждает этот очень важный шаг.)

Для сравнения вот мой бывший (неверный) M-код:

Файл-образец преобразования:

let Source = Excel.Workbook(Parameter1, null, true), #'Sample_Sheet' = Source{[Item='sample',Kind='Sheet']}[Data], #'Promoted Headers' = Table.PromoteHeaders(#'Sample_Sheet', [PromoteAllScalars=true]) in #'Promoted Headers' 

контрольная работа:

let Source = Folder.Files('C:some folder path'), #'Filtered Hidden Files1' = Table.SelectRows(Source, each [Attributes]?[Hidden]? <> true), #'Invoke Custom Function1' = Table.AddColumn(#'Filtered Hidden Files1', 'Transform File', each #'Transform File'([Content])), #'Renamed Columns1' = Table.RenameColumns(#'Invoke Custom Function1', {'Name', 'Source.Name'}), #'Removed Other Columns1' = Table.SelectColumns(#'Renamed Columns1', {'Source.Name', 'Transform File'}), #'Expanded Table Column1' = Table.ExpandTableColumn(#'Removed Other Columns1', 'Transform File', Table.ColumnNames(#'Transform File'(#'Sample File'))), #'Changed Type' = Table.TransformColumnTypes(#'Expanded Table Column1',{{'Source.Name', type text}, {'ID', type text}, {'Name', type text}}) in #'Changed Type' 

А вот мой новый (правильный) код:

Файл-образец преобразования:

let Source = Excel.Workbook(Parameter1, null, true), #'Removed Columns' = Table.RemoveColumns(Source,{'Name', 'Item', 'Kind', 'Hidden'}), Data = #'Removed Columns'{0}[Data], #'Promoted Headers' = Table.PromoteHeaders(Data, [PromoteAllScalars=true]), #'Changed Type' = Table.TransformColumnTypes(#'Promoted Headers',{{'ID', type text}, {'Name', type text}}) in #'Changed Type' 

контрольная работа:

let Source = Folder.Files('C:some folder path'), #'Filtered Hidden Files1' = Table.SelectRows(Source, each [Attributes]?[Hidden]? <> true), #'Invoke Custom Function1' = Table.AddColumn(#'Filtered Hidden Files1', 'Transform File', each #'Transform File'([Content])), #'Renamed Columns1' = Table.RenameColumns(#'Invoke Custom Function1', {'Name', 'Source.Name'}), #'Removed Other Columns1' = Table.SelectColumns(#'Renamed Columns1', {'Source.Name', 'Transform File'}), #'Expanded Table Column1' = Table.ExpandTableColumn(#'Removed Other Columns1', 'Transform File', Table.ColumnNames(#'Transform File'(#'Sample File'))) in #'Expanded Table Column1' 

Обратите внимание на шаг «Удаленные столбцы» в новом шаблоне запроса. Это «секретный соус» к ключевой проблеме. Также обратите внимание, что я сохранил все шаги по умолчанию после моего шага «Данные» (т.е. «Продвинутые заголовки» и «Измененный тип») в моем шаблоне запроса. Это потому, что все мои листы имеют одинаковую схему. Если бы это было не так, мне пришлось бы переместить эти шаги в обычный запрос.

  • Это решение требуется, когда в книгах используются разные имена листов. В противном случае достаточно простого «Объединить и загрузить».
  • У меня возникли проблемы с загрузкой данных из Smartsheet, и я использовал ваш ответ для навигации по своим справочным вопросам. Сначала я загрузил данные из нового расположения моих справочных таблиц. Во-вторых, я скопировал код навигации в существующие таблицы. Я получил сообщение об ошибке, спрашивающее, хочу ли я «отредактировать настройки» для источника данных, поскольку они не давали таблиц из исходной папки, из которой я загрузил справочные таблицы. Затем я смог получить доступ к возможности редактировать ссылку и просмотрел папки, чтобы найти расположение моих новых таблиц. В-третьих, я удалил все повторяющиеся таблицы, в результате

Tweet

Share

Link

Plus

Send

Send

Pin

Hi All,

I’m connecting to a data source on SQL server and faced the same «key didn’t match» issue. tried all suggestions from community and almost anything from net, but none has worked for me. 

After 7 hours of research and trial and error, I discovered something related to my credential on SQL server that was causing this issue.  I’m not sure why the «db_owner» was unticked!(might be due to the patching updates on the server) I checked the box then refreshed the report and now it is working as normal. 

PowerBI The Key did not match Solution.JPG

In SQL management Studio, navigate to the Databases[database name]SecurityUsers and double click on the userID to open the «Database User» window, then select the «membership» from the left side of the window.

I am the database owner so the db_owner is ticked, if you are not an owner, then make sure that at least the «db_datareader» is checked.

Hoping it helps you to save heaps of troubleshooting time.

Regards,

M

May 2023 Community Newsletter and Upcoming Events

Welcome to our May 2023 Community Newsletter, where we’ll be highlighting the latest news, releases, upcoming events, and the great work of our members inside the Biz Apps communities. If you’re new to this LinkedIn group, be sure to subscribe here in the News & Announcements to stay up to date with the latest news from our ever-growing membership network who «changed the way they thought about code».
 

 
 
LATEST NEWS
«Mondays at Microsoft» LIVE on LinkedIn — 8am PST — Monday 15th May  — Grab your Monday morning coffee and come join Principal Program Managers Heather Cook and Karuana Gatimu for the premiere episode of «Mondays at Microsoft»! This show will kick off the launch of the new Microsoft Community LinkedIn channel and cover a whole host of hot topics from across the #PowerPlatform, #ModernWork, #Dynamics365, #AI, and everything in-between. Just click the image below to register and come join the team LIVE on Monday 15th May 2023 at 8am PST. Hope to see you there!
 
 
Executive Keynote | Microsoft Customer Success Day
CVP for Business Applications & Platform, Charles Lamanna, shares the latest #BusinessApplications product enhancements and updates to help customers achieve their business outcomes.
 

 
S01E13 Power Platform Connections — 12pm PST — Thursday 11th May
Episode Thirteen of Power Platform Connections sees Hugo Bernier take a deep dive into the mind of co-host David Warner II, alongside the reviewing the great work of Dennis Goedegebuure, Keith Atherton, Michael Megel, Cat Schneider, and more.
Click below to subscribe and get notified, with David and Hugo LIVE in the YouTube chat from 12pm PST. And use the hashtag #PowerPlatformConnects on social media for a chance to have your work featured on the show.
 

 
UPCOMING EVENTS
 
European Power Platform Conference — early bird ticket sale ends!
The European Power Platform Conference early bird ticket sale ends on Friday 12th May 2023!
#EPPC23 brings together the Microsoft Power Platform Communities for three days of unrivaled days in-person learning, connections and inspiration, featuring three inspirational keynotes, six expert full-day tutorials, and over eighty-five specialist sessions, with guest speakers including April Dunnam, Dona Sarkar, Ilya Fainberg, Janet Robb, Daniel Laskewitz, Rui Santos, Jens Christian Schrøder, Marco Rocca, and many more. Deep dive into the latest product advancements as you hear from some of the brightest minds in the #PowerApps space.
Click here to book your ticket today and save! 
 
 

DynamicMinds Conference — Slovenia — 22-24th May 2023
It’s not long now until the DynamicsMinds Conference, which takes place in Slovenia on 22nd — 24th May, 2023 — where brilliant minds meet, mingle & share!
This great Power Platform and Dynamics 365 Conference features a whole host of amazing speakers, including the likes of Georg Glantschnig, Dona Sarkar, Tommy Skaue, Monique Hayward, Aleksandar Totovic, Rachel Profitt, Aurélien CLERE, Ana Inés Urrutia de Souza, Luca Pellegrini, Bostjan Golob, Shannon Mullins, Elena Baeva, Ivan Ficko, Guro Faller, Vivian Voss, Andrew Bibby, Tricia Sinclair, Roger Gilchrist, Sara Lagerquist, Steve Mordue, and many more.
Click here: DynamicsMinds Conference for more info on what is sure an amazing community conference covering all aspects of Power Platform and beyond. 
 

Days of Knowledge Conference in Denmark — 1-2nd June 2023
Check out ‘Days of Knowledge’, a Directions 4 Partners conference on 1st-2nd June in Odense, Denmark, which focuses on educating employees, sharing knowledge and upgrading Business Central professionals.
This fantastic two-day conference offers a combination of training sessions and workshops — all with Business Central and related products as the main topic. There’s a great list of industry experts sharing their knowledge, including Iona V., Bert Verbeek, Liza Juhlin, Douglas Romão, Carolina Edvinsson, Kim Dalsgaard Christensen, Inga Sartauskaite, Peik Bech-Andersen, Shannon Mullins, James Crowter, Mona Borksted Nielsen, Renato Fajdiga, Vivian Voss, Sven Noomen, Paulien Buskens, Andri Már Helgason, Kayleen Hannigan, Freddy Kristiansen, Signe Agerbo, Luc van Vugt, and many more.
If you want to meet industry experts, gain an advantage in the SMB-market, and acquire new knowledge about Microsoft Dynamics Business Central, click here Days of Knowledge Conference in Denmark to buy your ticket today!
 
COMMUNITY HIGHLIGHTS
Check out our top Super and Community Users reaching new levels! These hardworking members are posting, answering questions, kudos, and providing top solutions in their communities.
 
Power Apps: 
Super Users: @WarrenBelz, @LaurensM  @BCBuizer 
Community Users:  @Amik@ @mmollet, @Cr1t 
 
Power Automate: 
Super Users: @Expiscornovus , @grantjenkins, @abm 
Community Users: @Nived_Nambiar, @ManishSolanki 
 
Power Virtual Agents: 
Super Users: @Pstork1, @Expiscornovus 
Community Users: @JoseA, @fernandosilva, @angerfire1213 
 
Power Pages:
Super Users: @ragavanrajan 
Community Users: @Fubar, @Madhankumar_L,@gospa 

LATEST COMMUNITY BLOG ARTICLES 
Power Apps Community Blog 
Power Automate Community Blog 
Power Virtual Agents Community Blog 
Power Pages Community Blog 

Check out ‘Using the Community’ for more helpful tips and information: 
Power Apps , Power Automate, Power Virtual Agents, Power Pages 

Понравилась статья? Поделить с друзьями:
  • Ошибка ole class not registered объект ole игнорируется
  • Ошибка old world blues hoi 4
  • Ошибка old files does not exist
  • Ошибка ol2 на частотном преобразователе
  • Ошибка ol2 на частотнике yaskawa