Vain-vayne commented on issue #32914:
URL: 
https://github.com/apache/shardingsphere/issues/32914#issuecomment-2359692282

   - ShardingSphere-Proxy configuration file
   ```
   databaseName: log
   dataSources:
     ds_01:
       ...
     ds_02:
     ...
   rules:
   - !SHARDING
     tables:
       log_test:
         actualDataNodes: ds_${01..12}.log_test
         databaseStrategy:
           standard:
             shardingColumn: tran_month
             shardingAlgorithmName: shardingalgorithms_interval
         tableStrategy:
           none:
   ...
     shardingAlgorithms:
       shardingalgorithms_interval:
         type: INTERVAL
         props:
           datetime-pattern: "yyyyMM"
           datetime-lower: "202401"
           sharding-suffix-pattern: "MM"
           datetime-interval-amount: 1
           datetime-interval-unit: "MONTHS"
   ...
   ```
   
   - SQL
   ```
   INSERT INTO `log_test` (`TRAN_SN`, `TRAN_MONTH`, `TRAN_DATE`, `TRAN_TIME`) 
VALUES ('111111111','202401', '2024-01-10', '2024-01-10 11:26:08');
   ```
   
   - Error after executing SQL statement
   ```
   
org.apache.shardingsphere.sharding.exception.algorithm.NoShardingDatabaseRouteInfoException:
 No sharding database route info.
   ```
   
   - The configuration file must be changed to the following configuration to 
insert successfully
   ```
   
   databaseName: log
   
   dataSources:
     ds_202401:
       ...
     ds_202402:
     ...
   rules:
   - !SHARDING
     tables:
       log_acct_five_vld:
         actualDataNodes: ds_${202401..202412}.log_acct_five_vld
         databaseStrategy:
           standard:
             shardingColumn: tran_month
             shardingAlgorithmName: shardingalgorithms_interval
         tableStrategy:
           none:
   ...
     shardingAlgorithms:
       shardingalgorithms_interval:
         type: INTERVAL
         props:
           datetime-pattern: "yyyyMM"
           datetime-lower: "202401"
           sharding-suffix-pattern: "yyyyMM"
           datetime-interval-amount: 1
           datetime-interval-unit: "MONTHS"
   ...
   ```
   - sharding-suffix-pattern needs to use `yyyyMM`, not `MM`
   - I want to shard by month instead of year-month. How can I modify the 
configuration file?


-- 
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]

Reply via email to