Pentaho

 View Only
  • 1.  Regard MQL Query generation using SQL Model generated

    Posted 05-20-2024 02:23

    Actually I am trying to generate MQL Query using a view SQL given, for that first I tried generating a domain using SQL Model Generator in Pentaho-metadata github repo and now how should i use generated domain to get MQL Query, for testing purpose I am using MySQL. 



    ------------------------------

    Surojeet Ghosh

    BMC Software
    ------------------------------



  • 2.  RE: Regard MQL Query generation using SQL Model generated

    Posted 24 days ago

    Hello @Surojeet Ghosh,

    The user wants to generate MQL queries (queries for Hitachi Content Platform – HCP) based on a provided SQL view definition. They've tried using the SQL Model Generator from Pentaho but need guidance on converting the generated domain model (likely a class representation) into an MQL query.
    Analyze the generated domain model (classes and relationships) and manually translate it into an MQL query. This involves understanding the mapping between the SQL view schema and the MQL syntax.
    Explore if Pentaho or other tools offer functionalities to generate MQL queries from domain models. Some data modeling tools might have built-in features for code generation in different languages (including query languages).
    The complexity of the SQL view and the desired MQL functionality will influence the approach. Simple views might be manageable with manual mapping, while complex ones might require code generation tools or custom scripting.
    Consider the maintainability of the solution. If you anticipate frequent changes to the view definition, a more automated approach with code generation might be preferable. ny state of health


    Best Regards,



    ------------------------------
    Technomaria
    ------------------------------



  • 3.  RE: Regard MQL Query generation using SQL Model generated

    Posted 13 days ago

    Thanks for the answer but will there be no way of generating mql queries programmatically as I am trying to do this much simpler way, only code generation is the way possible for getting mql queries based on view sql.

    public static Query queryObject;

    public static IMetadataDomainRepository repo = new InMemoryMetadataDomainRepository();

    public static SqlGenerator gen = new SqlGenerator();

    // Code snippet

    createDomain(query); // domain generated

    LogicalModel logModel = domain.getLogicalModels().get(0);

    Query query = new Query(domain, logModel);

    repo.storeDomain(domain, false);

    DatabaseMeta meta = new DatabaseMeta("db", "MYSQL", "Native" , "localhost", "db", "3306", "root", "tiger");

    MappedQuery mQuery = gen.generateSql(query, "en_US", repo, meta);



    ------------------------------
    BMC Software
    ------------------------------