How can I get a list of named databases in an lmdb env? - lmdb

How does one get a list of the named databases that are part of an env ? From reading some python binding docs (named database implementation), I understand the names are stored in the main (unnamed?) db, but I'm not seeing them when browsing with a cursor.

All the named databases are stored in unnamed database as keys. Get all the keys then you will get list of named databases.
For this open dbi without any database name i.e pass null for named databse argument and read all the keys.
You can find it in the following documentation link:
lmdb documentation

Related

ArangoDB: How to list or export all documents in a database, regardless of collections

I see that there are APIs for listing and exporting all documents within a given collection, but I need to list/export all documents (ids) in all collections in a database simultaneously. (This is for V&V of a service I'm developing). Is this possible, or must I query for each collection one at a time?
Thanks!
arangodump will dump all the collections within a database, but the output format for a DOCUMENT is like this:
{"type":2300,"data": DOCUMENT}
There is one such entry per document in a per-collection file, which is named like so:
COLLECTION_07cf4f8f5d8b76282917320715dda2ad.data.json
It would be easy enough to extract DOCUMENT, e.g. using jq one would basically write: jq .data
arangoexport does allow one to specify multiple collections in a single invocation, but they must be specified explicitly.
One possibility for automating the use of arangoexport would be to use arangosh to generate the collection names in a specific database (using db._collections()), and then construct the appropriate arangoexport command or commands.

How do I specify the field types when using the Azure CLI entity insert command?

Does anyone know if there is a way to define the field types when using this Azure CLI 2.0 command
az storage entity insert . . .
from a Windows Power Shell prompt?
When I use it, all of the fields get inserted into the table with a type of string.
The parameters, as documented here az storage entity insert
, don't contain a way to explicitly state the method for defining the field types.
I'd like to be able to explicitly define the various field types for the non-string fields.
I've googled the above command a few ways and don't see any examples where folks are doing that.
I've tried inserting into an existing table where the fields and associated types already exist in other rows but the insert doesn't honor those values; probably because the types are attached to each row and not the table itself.
Also, I've tried inserting into a new table and the types aren't deduced (e.g., ...fieldname=false... is interpreted as a string and not a boolean.)
The Azure Storage Explorer will export rows. In the export, there are additional columns with the name structure of fieldname#type with values such as Edm.String,Edm.Boolean, etc. Using that structure, I've attempted to include those additional "fields" in the key=value pairs as a hint to the parser, but the call fails when I do that.
Without a way to define the types, this command seems only useful if all your field types are strings.
You can specify the type of the field by adding an additional pair of key-value in the form of field_name#odata.type=type_name.
For example:
az storage entity insert -c table_name -e PartitionKey=pk01 RowKey=1 Year=2018 Year#odata.type=Edm.Int32
For your reference, here's the REST call under the hood:
Reference: https://learn.microsoft.com/en-us/rest/api/storageservices/insert-entity.
This has been tested in both bash and cmd.

How to get list of all databases from arango console?

I do not see any function in help about getting all existing databases in ArangoDB.
To get the list of all existing databases from the Arango console (I am referring to the ArangoShell here), you can use:
db._databases();
In case you are looking for other methods: the shell has auto-completion, so you can type db. and then press the tab key. This will show the list of available properties/functions for the given object if it exists (and is a variable).

"show dbs" command only showing local database but not newly created ones

I started working with mongodb yesterday and can't seem to generate a database on the console. Every time I do the
use exampledb
switched to db exampledb
but for some reason I still generate only my locals..?
show dbs
local 0.078GB
I created a folder called /data/db in my root directory (following the tutorial) so I'm not sure what I am missing... help appreciated!
You are not missing anything. exampledb will be shown (using show dbs) only when you insert atleast one document in it. You can add collections manually if you want using db.createCollection().
Your database need to have atleast one document inside. First we need to add atleast one document into the selected database.
Example:
db.mycollection.insert({"name":"Max"})
where db is the general term not the name of the database and mycollection is the name of your collection, inside the insert give as key value pairs)
After that you can see your database.
Insert one Document and the "show dbs" command will display your database

How can I obtain the database schema from an existing ActiveRecord.cs file?

I have been given the source code for an existing project that uses SubSonic ORM. My (limited!) understanding is that SubSonic generates code by reverse-engineering the existing database. Unfortunately I don't have the database that was used for this project.
I do have the ActiveRecord.cs file from the last time it was compiled. How could I work out the database schema so I can reproduce the database?
This sounds like SubSonic 3. Here are a couple places to get you started based on me looking through my ActiveRecord.cs file. You might want to create a small database yourself, run SubSonic on it, and see what gets generated in ActiveRecord.cs.
Inside your ActiveRecord.cs file, you'll find one partial class per table. The partial class will inherit from IActiveRecord and will likely be the name of the table.
Inside the class, you'll find a function called "KeyName()" which will return your primary key column name for the table. SubSonic requires a primary key for tables it processes and generates code for.
Look for a region named " Foreign Keys ". If this table has foreign keys, you'll find a property corresponding to each foreign key, something like "public IQueryable OtherTableNames". So this table should have a column named something like "OtherTableNameID"; check the generated partial class for the foreign key table to be sure.
Immediately below the foreign key region, you'll find properties for the non-foreign key columns of this table. You can somewhat guess at the data types of the columns from the property data types (e.g. string might be a char(x) or a varchar(x)).

Resources