You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/01/16 08:49:37 UTC

[GitHub] [shardingsphere] RaigorJiang opened a new issue #14807: Add new DistSQL to export schema configuration

RaigorJiang opened a new issue #14807:
URL: https://github.com/apache/shardingsphere/issues/14807


   Hi community,
   
   starting from version 5.0.0, DistSQL provides many syntaxes to help users query resources and rule configuration, such as
   
   - SHOW SCHEMA RESOURCES
   - SHOW SHARDING TABLE RULES
   - SHOW SHARDING ALGORITHMS
   - SHOW READWRITE_SPLITTING RULES
   - ...
   
   However, if a user wants to obtain the complete configuration of a schema through DistSQL, it will be more difficult.
   
   On the other hand, there are users who want to define rules via DistSQL and export them as YAML. On the contrary, there are also users who want to convert the existing YAML files into DistSQL statements, so as to completely get rid of the constraints of configuration files.
   
   Therefore, I propose to design a series of new DistSQL syntax to help users achieve the above functions.
   
   Among them, the configuration export is a little easier, and we can start with this.
   
   ### Proposal
   
   For reference, I considered the following syntax:
   
   ```sql
   EXPORT SCHEMA (CONFIGURATION|CONFIG) [FROM schemaName] [, FILE="filePath"]
   ````
   
   When the user inputs `EXPORT SCHEMA CONIFG`, print out all the resources and rule configurations in the schema (organized in YAML text format);
   
   When the user inputs `EXPORT SCHEMA CONIFG, file="/Users/foo/config-sharding.yaml"`, write the resources and rule configurations in the schema to the target YAML file. (The permission of Proxy to write files needs to be guaranteed by the user, otherwise an exception will be thrown)
   \
   \
   The above is just a preliminary idea, any suggestions are welcome.
   
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] RaigorJiang commented on issue #14807: Add new DistSQL to export schema configuration

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on issue #14807:
URL: https://github.com/apache/shardingsphere/issues/14807#issuecomment-1024068433


   Hi @yx9o 
   Let's think about how to implement the `import` syntax. Users can input YAML content through SQL or provide a file path.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] RaigorJiang closed issue #14807: Add new DistSQL to export schema configuration

Posted by GitBox <gi...@apache.org>.
RaigorJiang closed issue #14807:
URL: https://github.com/apache/shardingsphere/issues/14807


   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] RaigorJiang commented on issue #14807: Add new DistSQL to export schema configuration

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on issue #14807:
URL: https://github.com/apache/shardingsphere/issues/14807#issuecomment-1013888111


   > Yes. I think it might be possible to make an optional? If I configure too many rules, I just want to check one of my rule configuration.
   
   It can be considered, but the syntax and keywords will not be easy to define. (configuration includes resources and rules).


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] totalo edited a comment on issue #14807: Add new DistSQL to export schema configuration

Posted by GitBox <gi...@apache.org>.
totalo edited a comment on issue #14807:
URL: https://github.com/apache/shardingsphere/issues/14807#issuecomment-1013893578


   > > Yes. I think it might be possible to make an optional? If I configure too many rules, I just want to check one of my rule configuration.
   > 
   > It can be considered, but the syntax and keywords will not be easy to define. (configuration includes resources and rules).
   
   How about `EXPORT SCHEMA typeOption? CONIFG`, we can use `ctx.typeOption.getText()` to get the type.
   ```
   typeOption
         : SHARDING | READWRITE_SPLITTING | ...
         ;
   ```


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] RaigorJiang commented on issue #14807: Add new DistSQL to export schema configuration

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on issue #14807:
URL: https://github.com/apache/shardingsphere/issues/14807#issuecomment-1013884821


   > Maybe add a type? For example, sharding, readwrite-splitting...
   
   Hi @totalo , Thanks for your suggestion, what is the effect?  Export only one rule's configuration?


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] yx9o commented on issue #14807: Add new DistSQL to export schema configuration

Posted by GitBox <gi...@apache.org>.
yx9o commented on issue #14807:
URL: https://github.com/apache/shardingsphere/issues/14807#issuecomment-1013867174


   I want to try.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] totalo commented on issue #14807: Add new DistSQL to export schema configuration

Posted by GitBox <gi...@apache.org>.
totalo commented on issue #14807:
URL: https://github.com/apache/shardingsphere/issues/14807#issuecomment-1013844970


   Maybe add a type? For example, sharding, readwrite-splitting...


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] totalo commented on issue #14807: Add new DistSQL to export schema configuration

Posted by GitBox <gi...@apache.org>.
totalo commented on issue #14807:
URL: https://github.com/apache/shardingsphere/issues/14807#issuecomment-1013887288


   > > Maybe add a type? For example, sharding, readwrite-splitting...
   > 
   > Hi @totalo , Thanks for your suggestion, what is the effect? Export only one rule's configuration?
   
   Yes. I think it might be possible to make an optional? If I configure too many rules, I just want to check one of my rule configuration.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] RaigorJiang commented on issue #14807: Add new DistSQL to export schema configuration

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on issue #14807:
URL: https://github.com/apache/shardingsphere/issues/14807#issuecomment-1014080752


   I don't think it's needed, just return the operation success?


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] totalo commented on issue #14807: Add new DistSQL to export schema configuration

Posted by GitBox <gi...@apache.org>.
totalo commented on issue #14807:
URL: https://github.com/apache/shardingsphere/issues/14807#issuecomment-1014155682


   > If it's just sharding, then `RULE` is more suitable than `CONFIG`. But again this would be very similar to `SHOW SHARDING TABLE RULE`.
   > 
   > I think `SCHEMA CONFIG` must includes all RESOURCES and RULES, If you want to expand optionals, then `EXPORT SHARDING TABLE RULE` would be more accurate.
   
   All right!


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] yx9o commented on issue #14807: Add new DistSQL to export schema configuration

Posted by GitBox <gi...@apache.org>.
yx9o commented on issue #14807:
URL: https://github.com/apache/shardingsphere/issues/14807#issuecomment-1024221832


   > Hi @yx9o Let's think about how to implement the `import` syntax. Users can input YAML content through SQL or provide a file path.
   
   I think the file import way is used more.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] RaigorJiang commented on issue #14807: Add new DistSQL to export schema configuration

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on issue #14807:
URL: https://github.com/apache/shardingsphere/issues/14807#issuecomment-1024802352


   > I think the file import way is used more.
   
   Yes, I think so.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] RaigorJiang commented on issue #14807: Add new DistSQL to export schema configuration

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on issue #14807:
URL: https://github.com/apache/shardingsphere/issues/14807#issuecomment-1013895634


   If it's just sharding, then `RULE` is more suitable than `CONFIG`.
   But again this would be very similar to `SHOW SHARDING TABLE RULE`.
   
   I think `SCHEMA CONFIG` must includes all RESOURCES and RULES,
   If you want to expand optionals, then `EXPORT SHARDING TABLE RULE` would be more accurate.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] RaigorJiang commented on issue #14807: Add new DistSQL to export schema configuration

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on issue #14807:
URL: https://github.com/apache/shardingsphere/issues/14807#issuecomment-1013885261


   > I want to try.
   
   Hi @yx9o ,
   Thanks for your attention, this issue may need more discussion, but you can do research first.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] yx9o commented on issue #14807: Add new DistSQL to export schema configuration

Posted by GitBox <gi...@apache.org>.
yx9o commented on issue #14807:
URL: https://github.com/apache/shardingsphere/issues/14807#issuecomment-1014074797


   `EXPORT SCHEMA CONIFG, file="/Users/foo/config-sharding.yaml"` Does this case include printing.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] totalo edited a comment on issue #14807: Add new DistSQL to export schema configuration

Posted by GitBox <gi...@apache.org>.
totalo edited a comment on issue #14807:
URL: https://github.com/apache/shardingsphere/issues/14807#issuecomment-1013893578


   > > Yes. I think it might be possible to make an optional? If I configure too many rules, I just want to check one of my rule configuration.
   > 
   > It can be considered, but the syntax and keywords will not be easy to define. (configuration includes resources and rules).
   
   How about `EXPORT SCHEMA typeOption? CONIFG`, we can use `ctx.typeOption.getText()` to get the type.
   ```
   typeOption
         : SHARDING | READWRITE_SPLITTING
         ;
   ```


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] totalo commented on issue #14807: Add new DistSQL to export schema configuration

Posted by GitBox <gi...@apache.org>.
totalo commented on issue #14807:
URL: https://github.com/apache/shardingsphere/issues/14807#issuecomment-1013893578


   > > Yes. I think it might be possible to make an optional? If I configure too many rules, I just want to check one of my rule configuration.
   > 
   > It can be considered, but the syntax and keywords will not be easy to define. (configuration includes resources and rules).
   
   How about `EXPORT SCHEMA typeOption? CONIFG`, we can use `ctx.typeOption.getText()` to get the type.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org