Skip to content

Draft: Generate specs from server

Merge Request Checklist

  • Link to an issue
  • Include the proposed fix or feature
  • Include and update tests for the modified code
  • Include a documentation change
  • Add an entry in the Unreleased section of the CHANGELOG

The main idea is to have a new CLI command that would generate a spec file from the existing server configuration. In order to do that I created a new class SnowflakeSpecGenerator that would be call by the CLI command. This class is using elements from SnowflakeConnector and SnowflakeSpecLoader and is returning the spec file.

Tasks:

  • Init SnowflakeSpecGenerator

  • Rework the SnowflakeConnector.show_query() function in order to be able to retrieve data from the show_query outputs (like owners or integration category), made retrocompatible.

  • get basic data from all entity types

  • cli

  • get the permissions and ownerships of roles

  • tests

  • clean up the code

  • fix the owner = '' bug

  • handle the syntax include / exclude for memberof

  • add member_of for users

  • formatting the spec file ?

Right now it produces a spec file as below:

databases:
- db1:
    owner: accountadmin
- db2:
    owner: sysadmin
integrations:
- integration1:
    category: security
- integration2:
    category: storage
roles:
- accountadmin:
    member_of:
    - securityadmin
    - sysadmin
    owner: ''
- role1:
    member_of:
    - bigrole1
    owner: useradmin
   ....
users:
- user1:
    can_login: true
    owner: accountadmin
warehouses:
- wh1:
    owner: accountadmin
    size: x-small

Once your merge request is complete, please assign it the Permifrost maintainers using the /assign_reviewer @gitlab-data/permifrost_maintainers placed in a comment for the review cycle. Once the review cycle is finished, the reviewer shall approve the merge request so it can be merged by any Permifrost developer, maintainer, or owner.

Edited by moreaupascal56

Merge request reports