Comments (4)
Adding the line
tiledb.default_ctx({"sm.dedup_coords": "true"})
now results in:tiledb.cc.TileDBError: Global context already initialized!
Just read, that this function needs be called before any other tiledb function calls, although I was only deleting the old array with:
if tiledb.object_type(tiledb_array_name) == "array":
tiledb.remove(tiledb_array_name)
from tiledb-py.
Hi @weidinger-c,
- The coordinate uniqueness requirement for a given array is controlled at the schema level by the
allows_duplicates
parameter toArraySchema
. (note: only applicable to sparse arrays) - The
sm.dedup_coords
setting is a runtime config option. Here's a demo for how to change it.
import tiledb, numpy as np, tempfile
tiledb.default_ctx({"sm.dedup_coords": "true"})
dims = []
dims.append(tiledb.Dim('X', (0, 1023), 1024, dtype=np.uint32))
attr = tiledb.Attr(name='', dtype=np.uint8)
schema = tiledb.ArraySchema(domain=tiledb.Domain(*dims), attrs=[attr], sparse=True)
uri = tempfile.mkdtemp()
tiledb.Array.create(uri, schema)
with tiledb.open(uri, "w") as A:
A[np.array([1,2,1])] = np.array([1,2,3])
with tiledb.open(uri) as B:
print(B[:])
Addiditionally I did not find any possibilty to get/print the current config that is used for a tiledb array.
Config options only control runtime behavior, and - there are defaults set for all calls unless you override. Configuration options are applied to a "Context", which can be controlled with:
tiledb.default_ctx
- can be called once at process start, before any othertiledb
calls. Will apply to all calls in the process, except those within ascope_ctx
block.tiledb.scope_ctx
- can be called (or nested) via awith
block, and will apply the context to all calls inside the block. Here's a demo:
import tiledb, numpy as np, tempfile
dims = []
dims.append(tiledb.Dim('X', (0, 1023), 1024, dtype=np.uint32))
attr = tiledb.Attr(name='', dtype=np.uint8)
schema = tiledb.ArraySchema(domain=tiledb.Domain(*dims), attrs=[attr], sparse=True)
uri = tempfile.mkdtemp()
tiledb.Array.create(uri, schema)
# creates a new context with config applied
with tiledb.scope_ctx(tiledb.Ctx({"sm.dedup_coords": "true"})):
with tiledb.open(uri, "w") as A:
A[np.array([1,2,1])] = np.array([1,2,3])
with tiledb.open(uri) as B:
print(B[:])
from tiledb-py.
Adding the line tiledb.default_ctx({"sm.dedup_coords": "true"})
now results in:
tiledb.cc.TileDBError: Global context already initialized!
from tiledb-py.
I was now able to write the points into the database, but unfortunately now when reading points, the process just exits. I will create a separate issue for this.
from tiledb-py.
Related Issues (20)
- [feature request] Query conditions have unexpected behavior with enum attributes
- Pip failed building wheel (MacOS 13, M1 silicon chip) HOT 10
- consolidating a group with mode=`group_meta` fails via tiledb.consolidate high-level function HOT 1
- consolidation followed by vacuum can corrupt array HOT 4
- Segfault on array_fragments call HOT 4
- pandas 2.2.0 breaks tests
- The nightly build job failed on Tuesday (2024-02-13) HOT 32
- The nightly build with earilest supported numpy job failed on Sunday (2024-03-03) HOT 24
- Reading and writing multiple cells with one function call to avoid loops in Python HOT 1
- Reading sparse tiledb array abruptly exits HOT 18
- Unable to consolidate via fragment_uris HOT 2
- add option `order=False`
- Can't read attributes of type DataType.GEOM_WKB / GEOM_WKT with pytiledb 0.28 HOT 2
- ast.Bytes Deprecation warning HOT 3
- The nightly build with earliest supported numpy job failed on Sunday (2024-05-19) HOT 1
- The nightly build with earliest supported numpy job failed on Tuesday (2024-05-21) HOT 3
- The nightly build job failed on Friday (2024-05-31) HOT 1
- The nightly build job failed on Wednesday (2024-06-05) HOT 83
- `tiledb.open("s3://...")` errors if pyarrow was imported before tiledb. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tiledb-py.