Skip to content

Instantly share code, notes, and snippets.

@tfoldi
Created January 30, 2016 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tfoldi/fa15d88b0ef04fcc74e2 to your computer and use it in GitHub Desktop.
Save tfoldi/fa15d88b0ef04fcc74e2 to your computer and use it in GitHub Desktop.
Get published data sources with workbooks
select *
from datasources
inner join data_connections on (data_connections.name = datasources.name)
inner join workbooks on (data_connections.owner_id = workbooks.id)
where data_connections.dbclass = 'sqlproxy';
Copy link

ghost commented Feb 2, 2016

Hi Tamás, thank you. For some reason, this SQL isn’t working for me.

From my v9.0.5 postgres, I get:

ERROR: column reference "asset_key_id" is ambiguous; Error while executing the query

Also, when I try to build the same join conditions using the visual data connection window in Tableau, I find that some of the published data sources have a DBCLASS = 'teradata' (not 'sqlproxy').

Thoughts ?
Thanks!
Keith Helfrich | Twitter
Red Headed Step Data

@viziblydiffrnt
Copy link

viziblydiffrnt commented Jun 10, 2016

This query will return a more reliable match as there could be more than datasource with the same name on your server

select w.id as workbook_id, w.name as workbook_name, d.id as datasource_id, d.name as datasource_name from data_connections dc join workbooks w on dc.owner_id=w.id join datasources d on w.id=d.parent_workbook_id where dc.caption = 'Sample - Superstore' and dc.dbclass = 'sqlproxy' ;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment