msyavuz opened a new issue, #44576:
URL: https://github.com/apache/superset/issues/44576

   ### Bug description
   
   Charts on a MongoDB dataset with `schema` set return no rows. 
`SqlaTable.get_sqla_table` builds `table(table_name, schema=schema)`, so the 
chart query renders `FROM "testdb"."orders"`. PyMongoSQL treats the whole 
`FROM` reference as the collection name and always queries the database in the 
connection URI, so it looks for a collection literally named `testdb.orders`.
   
   #44141 fixes the same rendering for SQL Lab (Data Preview and the schema 
selector) through `MongoDBEngineSpec.quote_table` and `adjust_engine_params`, 
but datasets don't go through `quote_table`.
   
   ### How to reproduce
   
   1. `docker run -d --rm -p 27017:27017 mongo:7` and seed documents into 
`testdb.orders`.
   2. Add a database with `mongodb://localhost:27017/testdb?mode=superset`.
   3. Create a dataset on `testdb` / `orders` and build any chart on it.
   4. The chart returns no data; the generated SQL has `FROM "testdb"."orders"`.
   
   ### Expected
   
   The chart queries the `orders` collection in `testdb`, either by rendering 
the bare collection name with the dataset's schema applied to the connection 
(as SQL Lab does after #44141), or by PyMongoSQL resolving `schema.collection`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to