小编Gau*_*rav的帖子

Linux - 保护环境变量

只是想知道是否有任何方法可以保护*nix系统中的环境变量,使得它们无法从任何纯文本文件中读取,但在环境中可用.

我知道我们总是可以使用.bashrc/.bash_profile的文件系统级别权限,但如果要完全隐藏某些变量(如数据库密码)呢?

一种方法是将某种程序/ perl脚本编写为:

  1. 从纯文本文件中获取输入并加密/散列内容(然后删除纯文本文件)
  2. 使用相同的方法来解密文件运行时并从解密的输出中导出值(我知道这个程序可以用来在某处转储解密的值,但我现在并不关心)

有没有其他更好,更明显的方法来实现这一目标?

谢谢!

-Gaurav

linux security bash

8
推荐指数
2
解决办法
5115
查看次数

Sqlalchemy - 核心 - 创建现有表的副本

我需要基于同一(Oracle)模式中的现有表创建一个表。我不想对新表有任何约束,即使原始表可能有一个或多个。

我尝试使用 来从原始表创建新表column.copy(),但由于某种原因,我无法在数据库中创建新表后删除约束。

def clone_table_approach_1(original_table, connection, metadata):
    try:
        new_table_name = original_table.name + '_sync'
        columns = [c.copy() for c in original_table.columns]
        new_table = Table(new_table_name, metadata, quote=False, *columns)

        # Create table in database
        if not new_table.exists():
            new_table.create()
        else:
            raise Exception("New table already exists")

        # Remove constraints from new table if any
        for constraint in new_table.constraints:
            connection.execute(DropConstraint(constraint))

        # Return table handle for newly created table
        final_cloned_table = Table(new_table, metadata, quote=False)
        return final_cloned_table

    except:
        # Drop if we did create a new …
Run Code Online (Sandbox Code Playgroud)

python oracle sqlalchemy

2
推荐指数
1
解决办法
3164
查看次数

标签 统计

bash ×1

linux ×1

oracle ×1

python ×1

security ×1

sqlalchemy ×1