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


Python Database.query_asdict方法代码示例

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


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

示例1: post

# 需要导入模块: from api_li3ds.database import Database [as 别名]
# 或者: from api_li3ds.database.Database import query_asdict [as 别名]
    def post(self):
        '''
        Import foreign schema for a rosbag file
        '''

        req = sql.SQL("""
            create schema if not exists {schema};
            select coalesce(max(pcid) + 1, 1) as pcid from pointcloud_formats
        """).format(schema=sql.Identifier(api.payload['schema']))
        pcid = Database.query_asdict(req)[0]['pcid']

        identifiers = {k: sql.Identifier(v) for k, v in api.payload.items()}
        req = sql.SQL("""
            import foreign schema {rosbag} limit to (pointcloud_formats)
            from server {server} into {schema} options (pcid %(pcid)s);

            insert into pointcloud_formats select pcid, srid, schema
            from {schema}.pointcloud_formats;

            import foreign schema {rosbag} except (pointcloud_formats)
            from server {server} into {schema} options (pcid %(pcid)s)
        """).format(**identifiers)
        Database.rowcount(req, {'pcid': str(pcid)})

        return "foreign schema imported", 201
开发者ID:LI3DS,项目名称:lids-api,代码行数:27,代码来源:foreignpc.py

示例2: post

# 需要导入模块: from api_li3ds.database import Database [as 别名]
# 或者: from api_li3ds.database.Database import query_asdict [as 别名]
 def post(self):
     '''Create a referential'''
     return Database.query_asdict(
         "insert into li3ds.referential (name, description, srid, sensor) "
         "values (%(name)s, %(description)s, %(srid)s, %(sensor)s) "
         "returning *",
         defaultpayload(api.payload)
     ), 201
开发者ID:LI3DS,项目名称:lids-api,代码行数:10,代码来源:referential.py

示例3: post

# 需要导入模块: from api_li3ds.database import Database [as 别名]
# 或者: from api_li3ds.database.Database import query_asdict [as 别名]
 def post(self):
     '''Create a transformation between referentials'''
     return Database.query_asdict(
         """
         insert into li3ds.transfo_tree (name, owner, transfos)
         values (%(name)s,%(owner)s,%(transfos)s)
         returning *
         """,
         defaultpayload(api.payload)
     ), 201
开发者ID:LI3DS,项目名称:lids-api,代码行数:12,代码来源:transfotree.py

示例4: post

# 需要导入模块: from api_li3ds.database import Database [as 别名]
# 或者: from api_li3ds.database.Database import query_asdict [as 别名]
 def post(self):
     '''Create a transformation type'''
     return Database.query_asdict(
         """
         insert into li3ds.transfo_type (name, description, func_signature)
         values (%(name)s,%(description)s,%(func_signature)s)
         returning *
         """,
         defaultpayload(api.payload)
     ), 201
开发者ID:LI3DS,项目名称:lids-api,代码行数:12,代码来源:transfo.py

示例5: post

# 需要导入模块: from api_li3ds.database import Database [as 别名]
# 或者: from api_li3ds.database.Database import query_asdict [as 别名]
 def post(self):
     '''Create a sensor'''
     return Database.query_asdict(
         """
         insert into li3ds.sensor (name, serial_number, brand,
                                   model, description, specifications, type)
         values (%(name)s, %(serial_number)s, %(brand)s,
                 %(model)s, %(description)s, %(specifications)s, %(type)s)
         returning *
         """,
         defaultpayload(api.payload)
     ), 201
开发者ID:LI3DS,项目名称:lids-api,代码行数:14,代码来源:sensor.py

示例6: post

# 需要导入模块: from api_li3ds.database import Database [as 别名]
# 或者: from api_li3ds.database.Database import query_asdict [as 别名]
 def post(self):
     '''
     Create a project.
     '''
     if 'timezone' not in api.payload:
         api.payload.update(timezone=project_model_post['timezone'].default)
     return Database.query_asdict(
         "insert into li3ds.project (name, timezone, extent) "
         "values (%(name)s, %(timezone)s, ST_Transform(%(extent)s::geometry,4326)) "
         "returning *",
         defaultpayload(api.payload)
     ), 201
开发者ID:LI3DS,项目名称:lids-api,代码行数:14,代码来源:project.py

示例7: transfo_tree

# 需要导入模块: from api_li3ds.database import Database [as 别名]
# 或者: from api_li3ds.database.Database import query_asdict [as 别名]
def transfo_tree(id):
    tftrees = Database.query_asdict(
        "select * from li3ds.transfo_tree where id=%s", (id,)
    )
    if not tftrees:
        return None
    transfo_tree = tftrees[0]

    name = "cluster_transfotree_{}".format(id)
    url = url_for('transfotree', id=id, _external=True)
    label = "TransfoTree: {name} ({id})".format_map(transfo_tree)

    return transfo_trees(name, url, label, [id])
开发者ID:LI3DS,项目名称:lids-api,代码行数:15,代码来源:dot.py

示例8: platform_config

# 需要导入模块: from api_li3ds.database import Database [as 别名]
# 或者: from api_li3ds.database.Database import query_asdict [as 别名]
def platform_config(id):

    configs = Database.query_asdict("""
        select p.name as pname, p.id as pid, c.transfo_trees, c.id, c.name
        from li3ds.platform_config c
        join li3ds.platform p on p.id = c.platform
        where c.id = %s
    """, (id, ))

    if not configs:
        return None
    config = configs[0]

    name = "cluster_config_{}".format(id)
    url = url_for('platform_config', id=id, _external=True)
    label = "Platform: {pname} ({pid})\\nConfiguration: {name} ({id})".format_map(config)
    return transfo_trees(name, url, label, config['transfo_trees'])
开发者ID:LI3DS,项目名称:lids-api,代码行数:19,代码来源:dot.py


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