예제 #1
0
파일: __init__.py 프로젝트: gucky92/loris
"""
Loris standard schemas
"""

from loris import conn

# connect when importing schema
conn()
예제 #2
0
                        type=str)

    args = parser.parse_args()
    # TODO connect as user?

    kwargs = json.loads(args.kwargs)

    # add loris to path if not installed
    try:
        from loris import config, conn
    except (ModuleNotFoundError, ImportError):
        filepath = __file__
        for i in range(4):
            filepath = os.path.dirname(filepath)
        print(filepath)
        sys.path.append(filepath)
        from loris import config, conn

    conn(user=args.user, password=args.password)

    table_class = getattr(config['schemata'][args.schema], args.table)

    restriction = kwargs.pop('restriction')
    settings_name = kwargs.pop('settings_name')
    print("settings_name:")
    print(settings_name)
    print("restriction:")
    print(restriction)

    table_class.populate(settings_name, restriction, **kwargs)