powerbi - Power BI:使用键盘重命名许多表和列
问题描述
有没有办法使用键盘重命名 Power BI 中的表和列。我有数百(或数千)个列和表,它们的名称需要比数据库中的名称更易于阅读。使用右键单击 | 重命名非常慢。切换到该列并按 F2 似乎不起作用。进入重命名模式的按键是什么?
或者...有没有办法在文本编辑器中打开一个 .pbix 文件,这样我就可以在那里完成工作?(当然,Microsoft 一定为文件选择了一些开放的、标准的、可移植的格式——比如 XML?;))我已经解压缩了文件,但 DataModel 文件似乎是二进制文件而不是存档文件。
解决方案
根据user12439754的回答...
(Power BI 中此任务的“易用性”非常糟糕。)
由于我使用的是 SQL Server,因此我能够编写一个完成大部分工作的脚本。
问题/未来增强:
- 参数化架构(或搜索所有架构)。
- 删除 #"Renamed Columns" 定义末尾的逗号。
用法:
- 运行脚本。
- 删除 #"Renamed Columns" 末尾的逗号。
- 根据需要将列名移动到 #"Removed Columns"。
- 将名称更改为您希望用户看到的名称。将结果(一次一个表)粘贴到高级编辑器中。
declare @q table (
id int identity(1,1) not null,
tbl varchar(128) not null,
col varchar(128) not null
)
insert @q
select o.name as 'Table'
, c.name as 'Column'
from sys.sysobjects o
inner join sys.syscolumns c on c.id = o.id
inner join sys.schemas s on s.schema_id = o.uid
where s.name = 'dbo'
order by o.name
, c.colorder
declare @tbl varchar(128), @t varchar(128), @c varchar(128)
select @tbl = (select top 1 tbl from @q order by id)
declare @i int, @max int
set @i = 1
select @max = count(*) from @q
declare @out table(
id int identity(1,1) not null,
a varchar(4000) not null
)
while @i <= @max
begin
select @t = (select tbl from @q where id = @i)
insert @out
values ('let')
, (' Source = Sql.Database("FinancialDM", "FinancialDataMart"),')
, (' dbo_' + @t + ' = Source{[Schema="dbo",Item="' + @t + '"]}[Data],')
, (' #"Removed Columns" = Table.RemoveColumns(dbo_' + @t + ',{}),')
, (' #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{')
while @tbl = @t and @i <= @max
begin
select @c = ' {"' + col + '", "' + col + '"}, ' from @q where id = @i
insert @out
values (@c)
set @i = @i + 1
select @t = (select tbl from @q where id = @i)
end
insert @out
values (' })')
, ('in')
, (' #"Renamed Columns"')
, ('')
, ('')
, ('')
set @tbl = @t
end
select *
from @out
推荐阅读
- sorting - 如何在woocomerce产品的批量编辑中添加批量菜单订单选项
- visual-studio - 部署 Unity 应用程序时出错(Connectivity.dll' 是延迟签名或测试签名的程序集。)
- typescript - 未在 RunOptions 接口上为类型定义 disableMultipleWindows
- c# - 使用 .NET Core 更新浏览器中显示的 URL
- amazon-web-services - S3 HTTP 状态 503 变慢
- html - div 总是在高度和宽度上占据窗口的大小
- android - Android 应用程序因 android.app.RemoteServiceException 崩溃:
- apache-kafka - Confluent 控制中心上传连接器错误
- r - 如何将寓言/预测(在 R 中)应用于该数据库?
- node.js - 我们如何在节点 http 代理中使用 AES 加密文件?