Forum Discussion

KareemMostafa12's avatar
3 years ago

Incremental refresh for MongoDB database

Will be happy if someone can help me πŸ˜”

i'm using MongoDB connected with PBI with BI connector to using ODBC DSN and every thing is working fine till now

recently i tried to setup incremental refresh by making Parameters <RangeStart> and <RangeEnd> then create filter for date/time columns filter-->betwwen and select in between dates. Once i close and Load the query the table gives error loading message "OLE DB or ODBC error: [DataSource.Error] ODBC: ERROR [HY000] [MySQL][ODBC 1.4(a) Driver][mysqld-5.7.12 mongosqld v2.14.5]This command is not supported in the prepared statement protocol yet.

Waiting my heroπŸ˜€

25 Replies

  • Are you running a custom query or are you applying the RangeStart/RangeEnd filter later in the Power Query transforms?

      • lbendlin's avatar
        lbendlin
        Super User

        May be that the query folding is not working properly for MongoDB.  Apply the parameters directly in the ODBC call.

         

        NOTE:  one of the parameters must be inclusive and the other must be exclusive.  Otherwise you end up with gaps or overlaps between partitions.

  • You are supposed to replace your code, not append to it.

     

    I used the [createdAt]  field as an example - modify as needed.

    • KareemMostafa12's avatar
      KareemMostafa12
      Helper I

      Hi Ibendlin!

      Yes my target column is also [CreatedAt] same as you mentioned in your code and i replaced with this code but when i click Done it gives this error message

        

      • lbendlin's avatar
        lbendlin
        Super User

        Good, making progress. What format does MongoDB expect for date or datetime fields?  Is "2023-01-17"  enough?