Skip to content

Commit

Permalink
fix goinception remote username and password using secret
Browse files Browse the repository at this point in the history
  • Loading branch information
bobfantansy committed Jul 14, 2023
1 parent d01a5c1 commit 3fe19bf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 10 additions & 0 deletions sql/engines/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ def remote_instance_conn(self, instance=None):
self.remote_port = instance.port
self.remote_user = instance.user
self.remote_password = instance.password

if not instance.awsSecretId == None and instance.awsSecretId.strip():
client = boto3.client('secretsmanager')
response = client.get_secret_value(
SecretId=instance.awsSecretId
)
secret = json.loads(response['SecretString'])
self.remote_user = secret["username"]
self.remote_password = secret["password"]

return (
self.remote_host,
self.remote_port,
Expand Down
1 change: 0 additions & 1 deletion sql/engines/goinception.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ def query_print(self, instance, db_name=None, sql=""):
use `{db_name}`;
{sql.rstrip(';')};
inception_magic_commit;"""
logger.info(f"执行goInception语法树打印语句:{sql}")
print_info = self.query(db_name=db_name, sql=sql).to_dict()[1]
if print_info.get("errmsg"):
raise RuntimeError(print_info.get("errmsg"))
Expand Down

0 comments on commit 3fe19bf

Please sign in to comment.