SAP-samples / hana-developer-cli-tool-example

Learn how to build a developer-centric SAP HANA command line tool, particularly designed to be used when performing SAP HANA development in non-SAP tooling (for example from VS Code).
Apache License 2.0
90 stars 24 forks source link

Optional namespace for generated cds #42

Closed ThePlenkov closed 3 years ago

ThePlenkov commented 3 years ago

In our CAP project we use hana-cli mc to convert database schema to cds. Later we use this cds in service cds views.

However it's quite time consuming to export every time table by table if schema contains many tables.

To improve the experience we can just declare namespace and then use this namespace in using instruction.

As an example if mc generates this file as model.cds:

entity![com.company.package::Table_1]{
  ...
};
entity![com.company.package::Table_2]{
  ...
};
entity![com.company.package::Table_3]{
  ...
};
entity![com.company.package::Table_4]{
  ...
};

then it requires us to write manually in each cds:

using {![com.company.package::Table_1], ![com.company.package::Table_2], ![com.company.package::Table_3] ... } from './model';

What is the proposal:

use hana-cli mc --namespace schema. Then generated file will look like this:

namespace schema;
entity1, entity2....

and we can reuse it already much easier

using schema from './model';
ThePlenkov commented 3 years ago

will propose in MR

jung-thomas commented 3 years ago

Merged into version 2.202105.5 - will release that version soon