Search is not available for this dataset
text stringlengths 75 104k |
|---|
def is_ordered(cat_id):
"""
Checks to see if a CatalogID has been ordered or not.
Args:
catalogID (str): The catalog ID from the platform catalog.
Returns:
ordered (bool): Whether or not the image has been ordered
"""
url = 'https://rda.geobigdata.io/v1/stripMetadata/{}'.f... |
def can_acomp(cat_id):
"""
Checks to see if a CatalogID can be atmos. compensated or not.
Args:
catalogID (str): The catalog ID from the platform catalog.
Returns:
available (bool): Whether or not the image can be acomp'd
"""
url = 'https://rda.geobigdata.io/v1/stripMetada... |
def deprecate_module_attr(mod, deprecated):
"""Return a wrapped object that warns about deprecated accesses"""
deprecated = set(deprecated)
class Wrapper(object):
def __getattr__(self, attr):
if attr in deprecated:
warnings.warn("Property {} is deprecated".format(attr), G... |
def get_matching_multiplex_port(self,name):
"""
Given a name, figure out if a multiplex port prefixes this name and return it. Otherwise return none.
"""
# short circuit: if the attribute name already exists return none
# if name in self._portnames: return None
# if no... |
def set(self, **kwargs):
"""
Set input values on task
Args:
arbitrary_keys: values for the keys
Returns:
None
"""
for port_name, port_value in kwargs.items():
# Support both port and port.value
if hasattr(port_value, 'v... |
def savedata(self, output, location=None):
'''
Save output data from any task in this workflow to S3
Args:
output: Reference task output (e.g. task.outputs.output1).
location (optional): Subfolder under which the output will be saved.
... |
def list_workflow_outputs(self):
'''
Get a list of outputs from the workflow that are saved to S3. To get resolved locations call workflow status.
Args:
None
Returns:
list
'''
workflow_outputs = []
for task in self.tasks:
for o... |
def generate_workflow_description(self):
'''
Generate workflow json for launching the workflow against the gbdx api
Args:
None
Returns:
json string
'''
if not self.tasks:
raise WorkflowError('Workflow contains no tasks, and cannot be ... |
def execute(self):
'''
Execute the workflow.
Args:
None
Returns:
Workflow_id
'''
# if not self.tasks:
# raise WorkflowError('Workflow contains no tasks, and cannot be executed.')
# for task in self.tasks:
# self.d... |
def task_ids(self):
'''
Get the task IDs of a running workflow
Args:
None
Returns:
List of task IDs
'''
if not self.id:
raise WorkflowError('Workflow is not running. Cannot get task IDs.')
if self.batch_values:
r... |
def cancel(self):
'''
Cancel a running workflow.
Args:
None
Returns:
None
'''
if not self.id:
raise WorkflowError('Workflow is not running. Cannot cancel.')
if self.batch_values:
self.workflow.batch_workflow_canc... |
def stdout(self):
''' Get stdout from all the tasks of a workflow.
Returns:
(list): tasks with their stdout
Example:
>>> workflow.stdout
[
{
"id": "4488895771403082552",
"taskType": "AOP_Strip_P... |
def stderr(self):
'''Get stderr from all the tasks of a workflow.
Returns:
(list): tasks with their stderr
Example:
>>> workflow.stderr
[
{
"id": "4488895771403082552",
"taskType": "AOP_Strip_Processor"... |
def layers(self):
""" Renders the list of layers to add to the map.
Returns:
layers (list): list of layer entries suitable for use in mapbox-gl 'map.addLayer()' call
"""
layers = [self._layer_def(style) for style in self.styles]
return layers |
def get_proj(prj_code):
"""
Helper method for handling projection codes that are unknown to pyproj
Args:
prj_code (str): an epsg proj code
Returns:
projection: a pyproj projection
"""
if prj_code in CUSTOM_PRJ:
proj = pyproj.Proj(CUSTOM_PRJ[prj_code])
else... |
def preview(image, **kwargs):
''' Show a slippy map preview of the image. Requires iPython.
Args:
image (image): image object to display
zoom (int): zoom level to intialize the map, default is 16
center (list): center coordinates to initialize the map, defaults to center of image
... |
def calc_toa_gain_offset(meta):
"""
Compute (gain, offset) tuples for each band of the specified image metadata
"""
# Set satellite index to look up cal factors
sat_index = meta['satid'].upper() + "_" + meta['bandid'].upper()
# Set scale for at sensor radiance
# Eq is:
# L = GAIN * DN *... |
def materialize(self, node=None, bounds=None, callback=None, out_format='TILE_STREAM', **kwargs):
"""
Materializes images into gbdx user buckets in s3.
Note: This method is only available to RDA based image classes.
Args:
node (str): the node in the graph to materiali... |
def list(self):
"""Lists available and visible GBDX tasks.
Returns:
List of tasks
"""
r = self.gbdx_connection.get(self._base_url)
raise_for_status(r)
return r.json()['tasks'] |
def register(self, task_json=None, json_filename=None):
"""Registers a new GBDX task.
Args:
task_json (dict): Dictionary representing task definition.
json_filename (str): A full path of a file with json representing the task definition.
Only one out of task_json and... |
def get_definition(self, task_name):
"""Gets definition of a registered GBDX task.
Args:
task_name (str): Task name.
Returns:
Dictionary representing the task definition.
"""
r = self.gbdx_connection.get(self._base_url + '/' + task_name)
raise_fo... |
def delete(self, task_name):
"""Deletes a GBDX task.
Args:
task_name (str): Task name.
Returns:
Response (str).
"""
r = self.gbdx_connection.delete(self._base_url + '/' + task_name)
raise_for_status(r)
return r.text |
def update(self, task_name, task_json):
"""Updates a GBDX task.
Args:
task_name (str): Task name.
task_json (dict): Dictionary representing updated task definition.
Returns:
Dictionary representing the updated task definition.
"""
r = self.gb... |
def to_geotiff(arr, path='./output.tif', proj=None, spec=None, bands=None, **kwargs):
''' Write out a geotiff file of the image
Args:
path (str): path to write the geotiff file to, default is ./output.tif
proj (str): EPSG string of projection to reproject to
spec (str): if set to 'rgb',... |
def ingest_vectors(self, output_port_value):
''' append two required tasks to the given output to ingest to VS
'''
# append two tasks to self['definition']['tasks']
ingest_task = Task('IngestItemJsonToVectorServices')
ingest_task.inputs.items = output_port_value
ingest_ta... |
def get(self, recipe_id):
'''
Retrieves an AnswerFactory Recipe by id
Args:
recipe_id The id of the recipe
Returns:
A JSON representation of the recipe
'''
self.logger.debug('Retrieving recipe by id: ' + recipe_id)
url = '%(base_url)s/rec... |
def save(self, recipe):
'''
Saves an AnswerFactory Recipe
Args:
recipe (dict): Dictionary specifying a recipe
Returns:
AnswerFactory Recipe id
'''
# test if this is a create vs. an update
if 'id' in recipe and recipe['id'] is not None:
... |
def save(self, project):
'''
Saves an AnswerFactory Project
Args:
project (dict): Dictionary specifying an AnswerFactory Project.
Returns:
AnswerFactory Project id
'''
# test if this is a create vs. an update
if 'id' in project and proje... |
def delete(self, project_id):
'''
Deletes a project by id
Args:
project_id: The project id to delete
Returns:
Nothing
'''
self.logger.debug('Deleting project by id: ' + project_id)
url = '%(base_url)s/%(project_id)s' % {
'ba... |
def paint(self):
"""
Renders a javascript snippet suitable for use as a mapbox-gl line paint entry
Returns:
A dict that can be converted to a mapbox-gl javascript paint snippet
"""
# TODO Figure out why i cant use some of these props
snippet = {
'... |
def paint(self):
"""
Renders a javascript snippet suitable for use as a mapbox-gl fill paint entry
Returns:
A dict that can be converted to a mapbox-gl javascript paint snippet
"""
snippet = {
'fill-opacity': VectorStyle.get_style_value(self.opacity),
... |
def paint(self):
"""
Renders a javascript snippet suitable for use as a mapbox-gl fill-extrusion paint entry
Returns:
A dict that can be converted to a mapbox-gl javascript paint snippet
"""
snippet = {
'fill-extrusion-opacity': VectorStyle.get_style_valu... |
def paint(self):
"""
Renders a javascript snippet suitable for use as a mapbox-gl heatmap paint entry
Returns:
A dict that can be converted to a mapbox-gl javascript paint snippet
"""
snippet = {
'heatmap-radius': VectorStyle.get_style_value(self.radius),... |
def create(self,vectors):
""" Create a vectors in the vector service.
Args:
vectors: A single geojson vector or a list of geojson vectors. Item_type and ingest_source are required.
Returns:
(list): IDs of the vectors created
Example:
>>> vectors.cre... |
def create_from_wkt(self, wkt, item_type, ingest_source, **attributes):
'''
Create a single vector in the vector service
Args:
wkt (str): wkt representation of the geometry
item_type (str): item_type of the vector
ingest_source (str): source of the vector
... |
def get(self, ID, index='vector-web-s'):
'''Retrieves a vector. Not usually necessary because searching is the best way to find & get stuff.
Args:
ID (str): ID of the vector object
index (str): Optional. Index the object lives in. defaults to 'vector-web-s'
Returns:
... |
def query(self, searchAreaWkt, query, count=100, ttl='5m', index=default_index):
'''
Perform a vector services query using the QUERY API
(https://gbdxdocs.digitalglobe.com/docs/vs-query-list-vector-items-returns-default-fields)
Args:
searchAreaWkt: WKT Polygon of area to sea... |
def query_iteratively(self, searchAreaWkt, query, count=100, ttl='5m', index=default_index):
'''
Perform a vector services query using the QUERY API
(https://gbdxdocs.digitalglobe.com/docs/vs-query-list-vector-items-returns-default-fields)
Args:
searchAreaWkt: WKT Polygon of... |
def aggregate_query(self, searchAreaWkt, agg_def, query=None, start_date=None, end_date=None, count=10, index=default_index):
"""Aggregates results of a query into buckets defined by the 'agg_def' parameter. The aggregations are
represented by dicts containing a 'name' key and a 'terms' key holding a l... |
def tilemap(self, query, styles={}, bbox=[-180,-90,180,90], zoom=16,
api_key=os.environ.get('MAPBOX_API_KEY', None),
image=None, image_bounds=None,
index="vector-user-provided", name="GBDX_Task_Output", **kwargs):
"""
Renders a mapbox... |
def map(self, features=None, query=None, styles=None,
bbox=[-180,-90,180,90], zoom=10, center=None,
image=None, image_bounds=None, cmap='viridis',
api_key=os.environ.get('MAPBOX_API_KEY', None), **kwargs):
"""
Renders a mapbox gl map from a vector... |
def read(self, bands=None, **kwargs):
"""Reads data from a dask array and returns the computed ndarray matching the given bands
Args:
bands (list): band indices to read from the image. Returns bands in the order specified in the list of bands.
Returns:
ndarray: a numpy ... |
def randwindow(self, window_shape):
"""Get a random window of a given shape from within an image
Args:
window_shape (tuple): The desired shape of the returned image as (height, width) in pixels.
Returns:
image: a new image object of the specified shape and same type
... |
def iterwindows(self, count=64, window_shape=(256, 256)):
""" Iterate over random windows of an image
Args:
count (int): the number of the windows to generate. Defaults to 64, if `None` will continue to iterate over random windows until stopped.
window_shape (tuple): The desired... |
def window_at(self, geom, window_shape):
"""Return a subsetted window of a given size, centered on a geometry object
Useful for generating training sets from vector training data
Will throw a ValueError if the window is not within the image bounds
Args:
geom (shapely,geomet... |
def window_cover(self, window_shape, pad=True):
""" Iterate over a grid of windows of a specified shape covering an image.
The image is divided into a grid of tiles of size window_shape. Each iteration returns
the next window.
Args:
window_shape (tuple): The desired shape ... |
def aoi(self, **kwargs):
""" Subsets the Image by the given bounds
Args:
bbox (list): optional. A bounding box array [minx, miny, maxx, maxy]
wkt (str): optional. A WKT geometry string
geojson (str): optional. A GeoJSON geometry dictionary
Returns:
... |
def pxbounds(self, geom, clip=False):
""" Returns the bounds of a geometry object in pixel coordinates
Args:
geom: Shapely geometry object or GeoJSON as Python dictionary or WKT string
clip (bool): Clip the bounds to the min/max extent of the image
Returns:
... |
def geotiff(self, **kwargs):
""" Creates a geotiff on the filesystem
Args:
path (str): optional, path to write the geotiff file to, default is ./output.tif
proj (str): optional, EPSG string of projection to reproject to
spec (str): optional, if set to 'rgb', write ou... |
def warp(self, dem=None, proj="EPSG:4326", **kwargs):
"""Delayed warp across an entire AOI or Image
Creates a new dask image by deferring calls to the warp_geometry on chunks
Args:
dem (ndarray): optional. A DEM for warping to specific elevation planes
proj (str): optio... |
def _parse_geoms(self, **kwargs):
""" Finds supported geometry types, parses them and returns the bbox """
bbox = kwargs.get('bbox', None)
wkt_geom = kwargs.get('wkt', None)
geojson = kwargs.get('geojson', None)
if bbox is not None:
g = box(*bbox)
elif wkt_geo... |
def load_url(url, shape=(8, 256, 256)):
""" Loads a geotiff url inside a thread and returns as an ndarray """
thread_id = threading.current_thread().ident
_curl = _curl_pool[thread_id]
_curl.setopt(_curl.URL, url)
_curl.setopt(pycurl.NOSIGNAL, 1)
_, ext = os.path.splitext(urlparse(url).path)
... |
def _tile_coords(self, bounds):
""" convert mercator bbox to tile index limits """
tfm = partial(pyproj.transform,
pyproj.Proj(init="epsg:3857"),
pyproj.Proj(init="epsg:4326"))
bounds = ops.transform(tfm, box(*bounds)).bounds
# because tiles h... |
def get(self, key, default=None):
"""
>>> inputs = InputPorts({"one": 1})
>>> "one" in inputs._ports
True
>>> "one" in inputs._vals
True
>>> inputs.get("one", 2) == 1
True
>>> inputs.get("two", 2) == 2
True
>>> "two" in inputs._port... |
def load_url(url, token, shape=(8, 256, 256)):
""" Loads a geotiff url inside a thread and returns as an ndarray """
_, ext = os.path.splitext(urlparse(url).path)
success = False
for i in xrange(MAX_RETRIES):
thread_id = threading.current_thread().ident
_curl = _curl_pool[thread_id]
... |
def launch(self, workflow):
"""Launches GBDX workflow.
Args:
workflow (dict): Dictionary specifying workflow tasks.
Returns:
Workflow id (str).
"""
# hit workflow api
try:
r = self.gbdx_connection.post(self.workflows_url, json=workfl... |
def status(self, workflow_id):
"""Checks workflow status.
Args:
workflow_id (str): Workflow id.
Returns:
Workflow status (str).
"""
self.logger.debug('Get status of workflow: ' + workflow_id)
url = '%(wf_url)s/%(wf_id)s' % {
'wf_u... |
def get_stdout(self, workflow_id, task_id):
"""Get stdout for a particular task.
Args:
workflow_id (str): Workflow id.
task_id (str): Task id.
Returns:
Stdout of the task (string).
"""
url = '%(wf_url)s/%(wf_id)s/tasks/%(task_id)s/stdout... |
def cancel(self, workflow_id):
"""Cancels a running workflow.
Args:
workflow_id (str): Workflow id.
Returns:
Nothing
"""
self.logger.debug('Canceling workflow: ' + workflow_id)
url = '%(wf_url)s/%(wf_id)s/cancel' % {
'wf_u... |
def launch_batch_workflow(self, batch_workflow):
"""Launches GBDX batch workflow.
Args:
batch_workflow (dict): Dictionary specifying batch workflow tasks.
Returns:
Batch Workflow id (str).
"""
# hit workflow api
url = '%(base_url)s/batch_workflo... |
def batch_workflow_status(self, batch_workflow_id):
"""Checks GBDX batch workflow status.
Args:
batch workflow_id (str): Batch workflow id.
Returns:
Batch Workflow status (str).
"""
self.logger.debug('Get status of batch workflow: ' + batch_workflow_... |
def batch_workflow_cancel(self, batch_workflow_id):
"""Cancels GBDX batch workflow.
Args:
batch workflow_id (str): Batch workflow id.
Returns:
Batch Workflow status (str).
"""
self.logger.debug('Cancel batch workflow: ' + batch_workflow_id)
u... |
def search(self, lookback_h=12, owner=None, state="all"):
"""Cancels GBDX batch workflow.
Params:
lookback_h (int): Look back time in hours.
owner (str): Workflow owner to search by
state (str): State to filter by, eg:
"submitted",
"s... |
def order(self, image_catalog_ids, batch_size=100, callback=None):
'''Orders images from GBDX.
Args:
image_catalog_ids (str or list): A single catalog id or a list of
catalog ids.
batch_size (int): The image_catalog_ids w... |
def status(self, order_id):
'''Checks imagery order status. There can be more than one image per
order and this function returns the status of all images
within the order.
Args:
order_id (str): The id of the order placed.
Returns:
List ... |
def heartbeat(self):
'''
Check the heartbeat of the ordering API
Args: None
Returns: True or False
'''
url = '%s/heartbeat' % self.base_url
# Auth is not required to hit the heartbeat
r = requests.get(url)
try:
return r.json() == "... |
def get(self, catID, includeRelationships=False):
'''Retrieves the strip footprint WKT string given a cat ID.
Args:
catID (str): The source catalog ID from the platform catalog.
includeRelationships (bool): whether to include graph links to related objects. Default False.
... |
def get_strip_metadata(self, catID):
'''Retrieves the strip catalog metadata given a cat ID.
Args:
catID (str): The source catalog ID from the platform catalog.
Returns:
metadata (dict): A metadata dictionary .
TODO: have this return a class object with int... |
def get_address_coords(self, address):
''' Use the google geocoder to get latitude and longitude for an address string
Args:
address: any address string
Returns:
A tuple of (lat,lng)
'''
url = "https://maps.googleapis.com/maps/api/geocode/json?&address="... |
def search_address(self, address, filters=None, startDate=None, endDate=None, types=None):
''' Perform a catalog search over an address string
Args:
address: any address string
filters: Array of filters. Optional. Example:
[
"(sensorPlatformName = '... |
def search_point(self, lat, lng, filters=None, startDate=None, endDate=None, types=None, type=None):
''' Perform a catalog search over a specific point, specified by lat,lng
Args:
lat: latitude
lng: longitude
filters: Array of filters. Optional. Example:
... |
def get_data_location(self, catalog_id):
"""
Find and return the S3 data location given a catalog_id.
Args:
catalog_id: The catalog ID
Returns:
A string containing the s3 location of the data associated with a catalog ID. Returns
None if the catalog... |
def search(self, searchAreaWkt=None, filters=None, startDate=None, endDate=None, types=None):
''' Perform a catalog search
Args:
searchAreaWkt: WKT Polygon of area to search. Optional.
filters: Array of filters. Optional. Example:
[
"(sensorPlatfor... |
def get_most_recent_images(self, results, types=[], sensors=[], N=1):
''' Return the most recent image
Args:
results: a catalog resultset, as returned from a search
types: array of types you want. optional.
sensors: array of sensornames. optional.
N: numb... |
def get_bytes_from_blob(val) -> bytes:
""" 不同数据库从blob拿出的数据有所差别,有的是memoryview有的是bytes """
if isinstance(val, bytes):
return val
elif isinstance(val, memoryview):
return val.tobytes()
else:
raise TypeError('invalid type for get bytes') |
def pagination_calc(items_count, page_size, cur_page=1, nearby=2):
"""
:param nearby:
:param items_count: count of all items
:param page_size: size of one page
:param cur_page: current page number, accept string digit
:return: num of pages, an iterator
"""
if type(cur_page) == str:
... |
def add_common_check(self, actions, table, func):
"""
emitted before query
:param actions:
:param table:
:param func:
:return:
"""
self.common_checks.append([table, actions, func])
"""def func(ability, user, action, available_columns: list):
... |
def add_record_check(self, actions, table, func):
# emitted after query
# table: 'table_name'
# column: ('table_name', 'column_name')
assert isinstance(table, str), '`table` must be table name'
for i in actions:
assert i not in (A.QUERY, A.CREATE), "meaningless action... |
def _parse_permission(self, obj):
"""
从 obj 中取出权限
:param obj:
:return: [A.QUERY, A.WRITE, ...]
"""
if isinstance(obj, str):
if obj == '*':
return A.ALL
elif obj in A.ALL:
return obj,
else:
... |
def can_with_columns(self, user, action, table, columns):
"""
根据权限进行列过滤
注意一点,只要有一个条件能够通过权限检测,那么过滤后还会有剩余条件,最终就不会报错。
如果全部条件都不能过检测,就会爆出权限错误了。
:param user:
:param action: 行为
:param table: 表名
:param columns: 列名列表
:return: 可用列的列表
"""
# T... |
def can_with_record(self, user, action, record: DataRecord, *, available=None):
"""
进行基于 Record 的权限判定,返回可用列。
:param user:
:param action:
:param record:
:param available: 限定检查范围
:return: 可用列
"""
assert action not in (A.QUERY, A.CREATE), "meaningless... |
def use(cls, name, method: [str, Set, List], url=None):
""" interface helper function"""
if not isinstance(method, (str, list, set, tuple)):
raise BaseException('Invalid type of method: %s' % type(method).__name__)
if isinstance(method, str):
method = {method}
#... |
async def get_ip(self) -> Union[IPv4Address, IPv6Address]:
"""
get ip address of client
:return:
"""
xff = await self.get_x_forwarded_for()
if xff: return xff[0]
ip_addr = self._request.transport.get_extra_info('peername')[0]
return ip_address(ip_addr) |
def finish(self, code, data=NotImplemented):
"""
Set response as {'code': xxx, 'data': xxx}
:param code:
:param data:
:return:
"""
if data is NotImplemented:
data = RETCODE.txt_cn.get(code, None)
self.ret_val = {'code': code, 'data': data} # f... |
def finish_raw(self, body: bytes, status: int = 200, content_type: Optional[str] = None):
"""
Set raw response
:param body:
:param status:
:param content_type:
:return:
"""
self.ret_val = body
self.response = web.Response(body=body, status=status, ... |
def add_soft_foreign_key(cls, column, table_name, alias=None):
"""
the column stores foreign table's primary key but isn't a foreign key (to avoid constraint)
warning: if the table not exists, will crash when query with loadfk
:param column: table's column
:param table_name: fore... |
def current_request_role(self) -> [int, str]:
"""
Current role requested by client.
:return:
"""
role_val = self.headers.get('Role')
return int(role_val) if role_val and role_val.isdigit() else role_val |
async def load_fk(self, info: SQLQueryInfo, records: Iterable[DataRecord]) -> Union[List, Iterable]:
"""
:param info:
:param records: the data got from database and filtered from permission
:return:
"""
# if not items, items is probably [], so return itself.
# if... |
async def _call_handle(self, func, *args):
""" call and check result of handle_query/read/insert/update """
await async_call(func, *args)
if self.is_finished:
raise FinishQuitException() |
async def after_update(self, raw_post: Dict, values: SQLValuesToWrite,
old_records: List[DataRecord], records: List[DataRecord]):
"""
:param old_records:
:param raw_post:
:param values:
:param records:
:return:
""" |
def roles(self):
"""
BaseUser.roles 的实现,返回用户可用角色
:return:
"""
ret = {None}
if self.state == POST_STATE.DEL:
return ret
ret.add('user')
return ret |
def gen_password_and_salt(cls, password_text):
""" 生成加密后的密码和盐 """
salt = os.urandom(32)
dk = hashlib.pbkdf2_hmac(
config.PASSWORD_HASH_FUNC_NAME,
password_text.encode('utf-8'),
salt,
config.PASSWORD_HASH_ITERATIONS,
)
return {'passw... |
def gen_token(cls):
""" 生成 access_token """
token = os.urandom(16)
token_time = int(time.time())
return {'token': token, 'token_time': token_time} |
def set_password(self, new_password):
""" 设置密码 """
info = self.gen_password_and_salt(new_password)
self.password = info['password']
self.salt = info['salt']
self.save() |
def _auth_base(self, password_text):
"""
已获取了用户对象,进行密码校验
:param password_text:
:return:
"""
dk = hashlib.pbkdf2_hmac(
config.PASSWORD_HASH_FUNC_NAME,
password_text.encode('utf-8'),
get_bytes_from_blob(self.salt),
config.PASS... |
async def get_session(cls, view):
"""
Every request have a session instance
:param view:
:return:
"""
session = cls(view)
session.key = await session.get_key()
session._data = await session.load() or {}
return session |
async def select_page(self, info: SQLQueryInfo, size=1, page=1) -> Tuple[Tuple[DataRecord, ...], int]:
"""
Select from database
:param info:
:param size: -1 means infinite
:param page:
:param need_count: if True, get count as second return value, otherwise -1
:ret... |
async def update(self, records: Iterable[DataRecord], values: SQLValuesToWrite, returning=False) -> Union[int, Iterable[DataRecord]]:
"""
:param records:
:param values:
:param returning:
:return: return count if returning is False, otherwise records
"""
raise NotI... |
async def insert(self, values_lst: Iterable[SQLValuesToWrite], returning=False) -> Union[int, List[DataRecord]]:
"""
:param values_lst:
:param returning:
:return: return count if returning is False, otherwise records
"""
raise NotImplementedError() |
def parse_order(text):
"""
:param text: order=id.desc, xxx.asc
:return: [
[<column>, asc|desc|default],
[<column2>, asc|desc|default],
]
"""
orders = []
for i in map(str.strip, text.split(',')):
items = i.split('.', 2)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.