<jupyter_start><jupyter_text>Manage Collections in your GeoDB  Connecting to the GeoDB<jupyter_code>from xcube_geodb.core.geodb import GeoDBClient
geodb = GeoDBClient()
# If you are logged in, this will tell you what account the system currently uses
geodb.whoami
# Lets get already existing collections
ds = geodb.get_my_collections()
ds<jupyter_output><empty_output><jupyter_text>Creating collectionsOnce the connection has been established you will be able to create a collection. The collection will contain standard properties (fields) plus custom propertieswhich you can add at your disgretion. Please use [PostGreSQL type definitions](https://www.postgresql.org/docs/11/datatype.html). We recommend stying simple withyour data types as we have not tested every single type.<jupyter_code># geodb.drop_collection('land_use')

# Have a look at fiona feature schema
collections = {
        "land_use": 
        {
            "crs": 3794,
            "properties": 
            {
                "RABA_PID": "float", 
                "RABA_ID": "float", 
                "D_OD": "date"
            }
        }
    }


geodb.create_collections(collections)
ds = geodb.get_my_collections()
ds<jupyter_output><empty_output><jupyter_text>Loading data into a datasetOnce the table has been created, you can load data into the dataset. The example below loads a shapefile. The attributes of the shapefile correspond to the dataset's properties.<jupyter_code>import geopandas
import os
gdf = geopandas.read_file(os.path.expanduser("~/.shared/notebooks/getting-started/data/sample/land_use.shp"))
gdf
geodb.insert_into_collection('land_use', gdf)
geodb.get_collection('land_use', query="raba_id=eq.7000")<jupyter_output><empty_output><jupyter_text>Delete from a Collection<jupyter_code>geodb.delete_from_collection('land_use', query="raba_id=eq.7000")
geodb.get_collection('land_use', query="raba_id=eq.7000")<jupyter_output><empty_output><jupyter_text>Updating a Collection<jupyter_code>geodb.get_collection('land_use', query="raba_id=eq.1300")
geodb.update_collection('land_use', query="raba_id=eq.1300", values={'d_od': '2000-01-01'})
geodb.get_collection('land_use', query="raba_id=eq.1300")<jupyter_output><empty_output><jupyter_text>Managing Properties of a Collection<jupyter_code>geodb.get_my_collections()
geodb.get_properties('land_use')
geodb.add_property('land_use', "test_prop", 'integer')
geodb.get_properties('land_use')
geodb.drop_property('land_use', 'test_prop')
geodb.get_properties('land_use')
geodb.add_properties('land_use', properties={'test1': 'integer', 'test2': 'date'})
geodb.get_properties('land_use')
geodb.drop_properties('land_use', properties=['test1', 'test2'])
geodb.get_properties('land_use')
geodb.drop_collection('land_use')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1163375224416517, 'fraction_numerical': 0.015080789946140035, 'mean_word_length': 6.017632241813602, 'pattern_counts': {'":': 6, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '363608', 'license': 'MIT', 'n_tokens_mistral': 986, 'n_tokens_neox': 917, 'n_words': 191, 'path': 'notebooks/getting-started/EDC_GeoDB_1_manage-datasets.ipynb', 'repo_name': 'jonas-eberle/notebooks', 'size': '2785'}