当前位置: 首页>>代码示例>>Python>>正文


Python HQLdesign.loads方法代码示例

本文整理汇总了Python中beeswax.design.HQLdesign.loads方法的典型用法代码示例。如果您正苦于以下问题:Python HQLdesign.loads方法的具体用法?Python HQLdesign.loads怎么用?Python HQLdesign.loads使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在beeswax.design.HQLdesign的用法示例。


在下文中一共展示了HQLdesign.loads方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: execute_query

# 需要导入模块: from beeswax.design import HQLdesign [as 别名]
# 或者: from beeswax.design.HQLdesign import loads [as 别名]
def execute_query(request, design_id=None, table=None):
  authorized_get_design(request, design_id)
  error_message, log = None, None
  form = query_form()
  action = request.path
  design = safe_get_design(request, SavedQuery.HQL, design_id)
  on_success_url = request.REQUEST.get('on_success_url')

  for _ in range(1):
    if request.method == 'POST':
      form.bind(request.POST)
      to_explain = request.POST.has_key('button-explain')
      to_submit = request.POST.has_key('button-submit')
      # Always validate the saveform, which will tell us whether it needs explicit saving
      if not form.is_valid():
        break
      to_save = form.saveform.cleaned_data['save']
      to_saveas = form.saveform.cleaned_data['saveas']
      if to_saveas and not design.is_auto:
        # Save As only affects a previously saved query
        design = design.clone()
      if to_submit or to_save or to_saveas or to_explain:
        explicit_save = to_save or to_saveas
        design = save_design(request, form, SavedQuery.HQL, design, explicit_save)
        action = urlresolvers.reverse(execute_query, kwargs=dict(design_id=design.id))

      # We're not going to process the form. Simply re-render it.
      if not to_explain and not to_submit:
        break

      query_str = _strip_trailing_semicolon(form.query.cleaned_data["query"])
      query_server = db_utils.get_query_server(form.query_servers.cleaned_data["server"])
      # (Optional) Parameterization.
      parameterization = get_parameterization(request, query_str, form, design, to_explain)
      if parameterization:
        return parameterization

      query_msg = make_beeswax_query(request, query_str, form)
      try:
        if to_explain:
          return expl_d(request, query_str, query_msg, design, query_server)
        else:
          notify = form.query.cleaned_data.get('email_notify', False)
          return e_d(request, query_msg, design=design,
            on_success_url=on_success_url,
            notify=notify)
      except BeeswaxException, ex:
        error_message, log = expand_exception(ex)
        # Fall through to re-render the execute form.
    else:
      # GET request
      if design.id is not None:
        data = HQLdesign.loads(design.data).get_query_dict()
        form.bind(data)
        form.saveform.set_data(design.name, design.desc)
      else:
        # New design
        form.bind()
开发者ID:DatalakeInc,项目名称:hortonworks-sandbox,代码行数:60,代码来源:views.py

示例2: design_to_dict

# 需要导入模块: from beeswax.design import HQLdesign [as 别名]
# 或者: from beeswax.design.HQLdesign import loads [as 别名]
def design_to_dict(design):
  hql_design = HQLdesign.loads(design.data)
  return {
    'id': design.id,
    'query': hql_design.hql_query,
    'name': design.name,
    'desc': design.desc,
    'database': hql_design.query.get('database', None),
    'settings': hql_design.settings,
    'file_resources': hql_design.file_resources,
    'functions': hql_design.functions,
    'is_parameterized': hql_design.query.get('is_parameterized', True),
    'email_notify': hql_design.query.get('email_notify', True)
  }
开发者ID:fhferreira,项目名称:hue,代码行数:16,代码来源:api.py

示例3: HQLdesign

# 需要导入模块: from beeswax.design import HQLdesign [as 别名]
# 或者: from beeswax.design.HQLdesign import loads [as 别名]
        try:
          query = HQLdesign(form)
          if to_explain:
            return explain_directly(request, query, design, query_server)
          else:
            notify = form.query.cleaned_data.get('email_notify', False)
            return execute_directly(request, query, query_server, design, on_success_url=on_success_url, notify=notify)
        except BeeswaxException, ex:
          print ex.errorCode
          print ex.SQLState
          db = dbms.get(request.user, query_server)
          error_message, log = expand_exception(ex, db)
  else:
    if design.id is not None:
      data = HQLdesign.loads(design.data).get_query_dict()
      form.bind(data)
      form.saveform.set_data(design.name, design.desc)
    else:
      # New design
      form.bind()

  return render('execute.mako', request, {
    'action': action,
    'design': design,
    'error_message': error_message,
    'form': form,
    'log': log,
    'on_success_url': on_success_url,
  })
开发者ID:chanshik,项目名称:hue,代码行数:31,代码来源:views.py

示例4: get_design

# 需要导入模块: from beeswax.design import HQLdesign [as 别名]
# 或者: from beeswax.design.HQLdesign import loads [as 别名]
 def get_design(self):
   try:
     return HQLdesign.loads(self.data)
   except ValueError:
     # data is empty
     pass
开发者ID:QLGu,项目名称:hue,代码行数:8,代码来源:models.py

示例5: get_design

# 需要导入模块: from beeswax.design import HQLdesign [as 别名]
# 或者: from beeswax.design.HQLdesign import loads [as 别名]
 def get_design(self):
   return HQLdesign.loads(self.data)
开发者ID:agibsonccc,项目名称:hue,代码行数:4,代码来源:models.py


注:本文中的beeswax.design.HQLdesign.loads方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。