亚马逊红移的视图管理

room_with_a_view的Python项目详细描述


有视野的房间

https://img.shields.io/pypi/v/room_with_a_view.svghttps://img.shields.io/travis/b12io/room_with_a_view.svgDocumentation StatusUpdates

亚马逊红移的视图管理

功能

room with a view是一个python脚本,它自动解析 用于查找视图和函数定义及其依赖项的SQL文件。那么 使这些视图与红移、自动删除和 根据需要重新创建依赖视图,以便没有错误。钥匙 好处是:

  • 没有编写代码将视图sql发送到redshift:脚本会为您执行此操作。
  • 编辑任何视图并同步它,而不必担心需要删除或重新创建 依赖于它的观点。
  • 错误处理可以准确地告诉您视图中存在错误的位置。
  • 脚本在原子事务中运行,因此不能意外地输入 通过同步某些视图而不是其他视图来破坏状态。

设置

  • 安装程序包:pip install room_with_a_view
  • 创建settings.yaml,然后编辑该文件以配置redshift连接和.sql文件的位置。示例settings.yaml文件:
connections:default:host:localhostport:5432user:awsuserpassword:**CHANGEME**dbname:postgresdirectories:-.
  • 你准备好了!尝试room_with_a_view sync-all同步所有视图,或room_with_a_view --help了解有关该命令的更多信息。

使用量

usage: room_with_a_view.py [-h]
                           [--view-names [VIEW-OR-FUNCTION-NAME [VIEW-OR-FUNCTION-NAME ...]]]
                           [--file-names [FILE-PATH [FILE-PATH ...]]]
                           [--connection CONNECTION]
                           [--settings SETTINGS] [--verbosity VERBOSITY]
                           {sync,drop-all,sync-all,list,drop}

Manages Redshift SQL views. Possible actions:
    sync: Syncs specific views or functions (identified by the --view-names or --file-names parameters).
    drop-all: Drops all views and functions in all .sql files in a set of directories (identified by the --directories parameter). The directory will be searched recursively.
    sync-all: Syncs all views and functions in all .sql files in a set of directories (identified by the --directories parameter). The directory will be searched recursively.
    list: lists all known views and functions.
    drop: Drops specific views or functions (identified by the --view-names or --file-names parameters).

positional arguments:
  {sync,drop-all,sync-all,list,drop}
                        The action to perform.

optional arguments:
  -h, --help            show this help message and exit
  --view-names [VIEW-OR-FUNCTION-NAME [VIEW-OR-FUNCTION-NAME ...]]
                        Names of views or functions to which to apply the action.
  --file-names [FILE-PATH [FILE-PATH ...]]
                        Paths to .sql files to which to apply the action.
  --connection CONNECTION
                        Name of the Redshift connection to use (or "default",
                        if not specified). The name must match a connection in
                        settings.yaml
  --settings SETTINGS   Location of the settings file (settings.yaml by
                        default)
  --verbosity VERBOSITY
                        Verbosity of script output. 0 will output nothing, 1
                        will output names of views and functions being dropped
                        and created, and 2 will output all executed sql

示例

  • room_with_a_view.py sync-all:同步settings.yaml中指定的默认目录中所有sql文件中的所有视图和函数。删除并重新创建现有视图,并确保按依赖顺序创建视图。
  • room_with_a_view.py sync --view-names my_view1 my_func1 --file-names../sql/my_file.sql:同步特定视图my_view1和函数my_func1,以及文件../sql/my_file.sql中的所有视图和函数。
  • room_with_a_view.py drop-all--connection other_connection:删除默认目录中的所有视图和函数,使用名称other_connection下的settings.yaml中指定的连接信息连接到redshift。
  • room_with_a_view.py drop --view-names my_view1 --directories other_dir1 other_dir2 --settings /path/to/fancy_settings.yaml:删除视图my_view1,在位于/path/to/fancy_settings.yaml的设置文件中的other_dir1other_dir2指定的目录中查找包含该视图及其依赖项的SQL文件。

学分

这个包是用Cookiecutteraudreyr/cookiecutter-pypackage项目模板创建的。

历史记录

0.1.0(2018-05-28)

  • pypi上的第一个版本。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Spring AOP:在方法之间交换信息   数组Java将字符串转换为字符[]   堆内存java。lang.OutOfMemoryError:PermGen space+java   安卓 Java。lang.ClassCastException:无法将活动强制转换到接口   java尝试使用气泡排序将随机整数数组从最大到最小排序   线程“main”java中的indexoutofboundsexception异常。lang.ArrayIndexOutofBounds异常:发电机处为3。main(Generator.java:35)   java“宽大”有什么用?   java SimpleCaptcha NoSuchMethodError   java在哪里部署Web服务的jar依赖项?   Java8获取列表中连续数字的函数方法   java为什么JWT令牌不安全?   java Uber API:在请求或发出令牌时指定多个作用域会返回无效的请求参数   java如何使用映射器从包含多个引用单元的JSON字符串中获取对象列表?   java警告匿名子类(?)没有串行版本   Jackson 2.9.0中的java JsonGenerationException。pr1   java试图打印多个catch语句   java如何创建一个sql表并获得每个唯一字段的平均价格?   java为什么SetMinimumSize设置最小高度而不是宽度?   java与使用POI合并的混淆   java在Xpath中使用“AND”和“normalizespace”时在不同浏览器中遇到不同的错误