Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

Timestamps are not returned as datetime by custom ODBC data connector

Hi,

 

I've created a custom ODBC dataconnector which uses an ODBC driver provided by Elasticsearch. My connector script:

 

[DataSource.Kind="ElasticOdbcConnector", Publish="ElasticOdbcConnector.Publish"]
shared ElasticOdbcConnector.Contents = (server as text) =>
    let
	ConnectionString = [
            Driver = "Elasticsearch Driver",
            Server = server,
            ApplicationIntent = "readonly"
        ],
        OdbcDatasource = Odbc.DataSource(ConnectionString)
    in
        OdbcDatasource;

 

When I retrieve the data in Power BI Desktop using DirectQuery, the timestamp field is not listed as a datetime field:

 

I can convert it to a datetime field via PowerQuery, but then I'll lose the DirectQuery capability of my connector.

When I connect to Elasticsearch using the standard ODBC connector and a DSN, the timestamp field is listed as a datetime field correctly:

 

How do I let PowerBI see the correct field types? Is there something extra I need to do in my custom data connector?

No Replies