sqlite_type_helper.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:PlasoScaffolder 作者: ClaudiaSaxer 项目源码 文件源码
def _GetEndOfTableIfNotAlias(self, query: str, column_name: str) -> bool:
    """Getting the start of the column if it is not an alias column

    Args:
      query (str): the query to be searched
      column_name (str): the name to be searched for

    Returns:
      bool: 0 if no column could be found or the starting position of the
          column
    """
    wrong_positions = [name.start() for name in
                       re.finditer('.{0} as'.format(column_name), query)]
    found_positions = []
    for space in self._POSSIBLEQUERYSEPERATOR:
      found_positions += [name.start() for name in
                          re.finditer('.{0}{1}'.format(column_name, space),
                                      query)]

    position = set(found_positions) - set(wrong_positions)

    if position:
      return position.pop()
    else:
      return 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号