geobox 2.2.5__py3-none-any.whl → 2.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- geobox/aio/api.py +114 -1
- geobox/aio/table.py +1144 -0
- geobox/api.py +131 -13
- geobox/enums.py +5 -1
- geobox/field.py +21 -10
- geobox/table.py +1134 -0
- {geobox-2.2.5.dist-info → geobox-2.3.0.dist-info}/METADATA +2 -2
- {geobox-2.2.5.dist-info → geobox-2.3.0.dist-info}/RECORD +11 -9
- {geobox-2.2.5.dist-info → geobox-2.3.0.dist-info}/WHEEL +0 -0
- {geobox-2.2.5.dist-info → geobox-2.3.0.dist-info}/licenses/LICENSE +0 -0
- {geobox-2.2.5.dist-info → geobox-2.3.0.dist-info}/top_level.txt +0 -0
geobox/aio/api.py
CHANGED
|
@@ -3,7 +3,7 @@ import asyncio
|
|
|
3
3
|
import logging
|
|
4
4
|
import os
|
|
5
5
|
from urllib.parse import urljoin
|
|
6
|
-
from typing import Dict, List, Union, Any
|
|
6
|
+
from typing import Dict, List, Union, Any, Optional
|
|
7
7
|
from datetime import datetime
|
|
8
8
|
|
|
9
9
|
from .vectorlayer import AsyncVectorLayer, LayerType
|
|
@@ -32,6 +32,7 @@ from .attachment import AsyncAttachment
|
|
|
32
32
|
from .apikey import AsyncApiKey
|
|
33
33
|
from .log import AsyncLog
|
|
34
34
|
from .usage import AsyncUsage, UsageScale, UsageParam
|
|
35
|
+
from .table import AsyncTable
|
|
35
36
|
from ..exception import AuthenticationError, ApiRequestError, NotFoundError, ValidationError, ServerError, AuthorizationError
|
|
36
37
|
from ..utils import join_url_params
|
|
37
38
|
|
|
@@ -2654,3 +2655,115 @@ class AsyncGeoboxClient:
|
|
|
2654
2655
|
>>> await client.update_usage()
|
|
2655
2656
|
"""
|
|
2656
2657
|
return await AsyncUsage.update_usage(self, user_id=user_id)
|
|
2658
|
+
|
|
2659
|
+
|
|
2660
|
+
async def get_tables(self, **kwargs) -> Union[List['AsyncTable'], int]:
|
|
2661
|
+
"""
|
|
2662
|
+
[async] Get list of tables with optional filtering and pagination.
|
|
2663
|
+
|
|
2664
|
+
Keyword Args:
|
|
2665
|
+
include_settings (bool): Whether to include table settings. default: False
|
|
2666
|
+
temporary (bool): Whether to return temporary tables. default: False
|
|
2667
|
+
q (str): query filter based on OGC CQL standard. e.g. "field1 LIKE '%GIS%' AND created_at > '2021-01-01'"
|
|
2668
|
+
search (str): search term for keyword-based searching among search_fields or all textual fields if search_fields does not have value. NOTE: if q param is defined this param will be ignored
|
|
2669
|
+
search_fields (str): comma separated list of fields for searching
|
|
2670
|
+
order_by (str): comma separated list of fields for sorting results [field1 A|D, field2 A|D, …]. e.g. name A, type D. NOTE: "A" denotes ascending order and "D" denotes descending order.
|
|
2671
|
+
return_count (bool): Whether to return total count. default: False.
|
|
2672
|
+
skip (int): Number of items to skip. default: 0
|
|
2673
|
+
limit (int): Number of items to return. default: 10
|
|
2674
|
+
user_id (int): Specific user. privileges required
|
|
2675
|
+
shared (bool): Whether to return shared tables. default: False
|
|
2676
|
+
|
|
2677
|
+
Returns:
|
|
2678
|
+
List[AsyncTable] | int: A list of table instances or the total number of tables.
|
|
2679
|
+
|
|
2680
|
+
Example:
|
|
2681
|
+
>>> from geobox.aio import AsyncGeoboxClient
|
|
2682
|
+
>>> async with AsyncGeoboxClient() as client:
|
|
2683
|
+
>>> tables = await client.get_tables(q="name LIKE '%My table%'")
|
|
2684
|
+
"""
|
|
2685
|
+
return await AsyncTable.get_tables(self, **kwargs)
|
|
2686
|
+
|
|
2687
|
+
|
|
2688
|
+
async def create_table(self,
|
|
2689
|
+
name: str,
|
|
2690
|
+
display_name: Optional[str] = None,
|
|
2691
|
+
description: Optional[str] = None,
|
|
2692
|
+
temporary: bool = False,
|
|
2693
|
+
fields: Optional[List[Dict]] = None,
|
|
2694
|
+
) -> 'AsyncTable':
|
|
2695
|
+
"""
|
|
2696
|
+
[async] Create a new table.
|
|
2697
|
+
|
|
2698
|
+
Args:
|
|
2699
|
+
name (str): The name of the Table.
|
|
2700
|
+
display_name (str, optional): The display name of the table.
|
|
2701
|
+
description (str, optional): The description of the table.
|
|
2702
|
+
temporary (bool, optional): Whether to create a temporary tables. default: False
|
|
2703
|
+
fields (List[Dict], optional): raw table fields. you can use add_field method for simpler and safer field addition. required dictionary keys: name, datatype
|
|
2704
|
+
|
|
2705
|
+
Returns:
|
|
2706
|
+
AsyncTable: The newly created table instance.
|
|
2707
|
+
|
|
2708
|
+
Raises:
|
|
2709
|
+
ValidationError: If the table data is invalid.
|
|
2710
|
+
|
|
2711
|
+
Example:
|
|
2712
|
+
>>> from geobox.aio import AsyncGeoboxClient
|
|
2713
|
+
>>> async with AsyncGeoboxClient() as client:
|
|
2714
|
+
>>> table = await client.create_table(name="my_table")
|
|
2715
|
+
"""
|
|
2716
|
+
return await AsyncTable.create_table(self,
|
|
2717
|
+
name=name,
|
|
2718
|
+
display_name=display_name,
|
|
2719
|
+
description=description,
|
|
2720
|
+
temporary=temporary,
|
|
2721
|
+
fields=fields,
|
|
2722
|
+
)
|
|
2723
|
+
|
|
2724
|
+
|
|
2725
|
+
async def get_table(self,
|
|
2726
|
+
uuid: str,
|
|
2727
|
+
user_id: int = None,
|
|
2728
|
+
) -> 'AsyncTable':
|
|
2729
|
+
"""
|
|
2730
|
+
[async] Get a table by UUID.
|
|
2731
|
+
|
|
2732
|
+
Args:
|
|
2733
|
+
uuid (str): The UUID of the table to get.
|
|
2734
|
+
user_id (int): Specific user. privileges required.
|
|
2735
|
+
|
|
2736
|
+
Returns:
|
|
2737
|
+
AsyncTable: The Table object.
|
|
2738
|
+
|
|
2739
|
+
Raises:
|
|
2740
|
+
NotFoundError: If the table with the specified UUID is not found.
|
|
2741
|
+
|
|
2742
|
+
Example:
|
|
2743
|
+
>>> from geobox.aio import AsyncGeoboxClient
|
|
2744
|
+
>>> async with AsyncGeoboxClient() as client:
|
|
2745
|
+
>>> table = await client.get_table(uuid="12345678-1234-5678-1234-567812345678")
|
|
2746
|
+
"""
|
|
2747
|
+
return await AsyncTable.get_table(self, uuid, user_id)
|
|
2748
|
+
|
|
2749
|
+
|
|
2750
|
+
async def get_table_by_name(self,
|
|
2751
|
+
name: str,
|
|
2752
|
+
user_id: int = None,
|
|
2753
|
+
) -> Union['AsyncTable', None]:
|
|
2754
|
+
"""
|
|
2755
|
+
[async] Get a table by name
|
|
2756
|
+
|
|
2757
|
+
Args:
|
|
2758
|
+
name (str): the name of the table to get
|
|
2759
|
+
user_id (int, optional): specific user. privileges required.
|
|
2760
|
+
|
|
2761
|
+
Returns:
|
|
2762
|
+
AsyncTable | None: returns the table if a table matches the given name, else None
|
|
2763
|
+
|
|
2764
|
+
Example:
|
|
2765
|
+
>>> from geobox.aio import AsybcGeoboxClient
|
|
2766
|
+
>>> async with AsyncGeoboxClient() as client:
|
|
2767
|
+
>>> table = await client.get_table_by_name(name='test')
|
|
2768
|
+
"""
|
|
2769
|
+
return await AsyncTable.get_table_by_name(self, name, user_id)
|