Forum Discussion

pmscorca's avatar
pmscorca
Icon for Post Prodigy rankPost Prodigy
8 months ago
Solved

SAP HANA source tables not found using the SAP HANA database connector

Hi, in my Fabric solution I've created a SAP HANA connection to get data from an on-premise SAP HANA source, specifying the received server, port, user and password for basic authentication. I can ...
  • jjgb's avatar
    8 months ago

    Regarding this:

     


    There is currently no supported option in Fabric to force Dataflow Gen2 to enumerate raw SAP HANA tables

     

    One way to query raw SAP HANA tables within a Dataflow Gen 2 is to use the SAP HANA Power Query connector support for native queries. Simply create a native query that can be as simple as "select * from table", and make sure EnableFolding is set to true. Then you can apply operators from the Power Query UX and most will "fold" to the HANA database. It supports parameterized queries (even when EnableFolding is true), as documented here:
    https://learn.microsoft.com/en-us/power-query/connectors/sap-hana/overview#native-query-support-in-the-sap-hana-database-connector 

    Using this approach, you could even join two tables and the join will fold, just keep a look at the query folding indicators to make sure the operations are getting folded.

    For example:

    let
        SalesNativeQuery =
            Value.NativeQuery(
                SapHana.Database(":", [Implementation = "2.0"]),
                "select ""MAKE"", ""MODEL"", ""CITY"" from ""AN_SALES"" where ""GENDER"" = ? and ""MODEL"" = ?",
                {"F", "Carretera"},
                [EnableFolding = true]
            ),
    
        ProductNativeQuery =
            Value.NativeQuery(
                SapHana.Database(":", [Implementation = "2.0"]),
                "select ""MAKE"", ""PRODUCT_LINE"", ""CATEGORY"" from ""PRODUCT_CATALOG"" where ""CATEGORY"" = ?",
                {"Bikes"},
                [EnableFolding = true]
            ),
    
        Merge =
            Table.NestedJoin(
                SalesNativeQuery, {"MAKE"},
                ProductNativeQuery, {"MAKE"},
                "Product",
                JoinKind.LeftOuter
            ),
    
        #"Expanded Product" =
            Table.ExpandTableColumn(
                Merge,
                "Product",
                {"PRODUCT_LINE", "CATEGORY"},
                {"Product.PRODUCT_LINE", "Product.CATEGORY"}
            )
    in
        #"Expanded Product"