I have a FaunaDB database of "RaspberryPi" and their child database of "00000000790f4c7c" as following:
So how can I open the child database "00000000790f4c7c"?
I've tried to open 00000000790f4c7c and RaspberryPi/00000000790f4c7c, but both just get errored.
MacBook-Air:~ takeyuki$ fauna shell RaspberryPi/00000000790f4c7c
Error: Database 'RaspberryPi/00000000790f4c7c' doesn't exist
MacBook-Air:~ takeyuki$ fauna shell 00000000790f4c7c
Error: Database '00000000790f4c7c' doesn't exist
Thank you for your kindly help!
Unfortunately the shell doesn't have great support for nested databases at the moment. You want to either create an endpoint to the parent say "RaspberryPi" with an admin key then invoke fauna shell 00000000790f4c7c or you can create a key inside RaspberryPi with CreateKey({role: "server", database: "00000000790f4c7c"}) and create and endpoint with that secret, or access it directly with fauna shell --secret XXX where XXX is the secret from the created key.
The key (no pun intended) is that whatever your current endpoint is fauna shell $db will try to access a database $db nested inside the database point at by that endpoint. By default that's / so fauna shell $db lands in /$db if you have an endpoint /$parent and invoke fauna shell $child then you'll end up in /$parent/$child. If you leave off $db then you end up in whatever database the endpoint is pointing at. so if you have an endpoint n components deep you have access to it and all it's children at n + 1 only.
Better support for nested databases is on the roadmap, because that's not particularly ergonomic.
Related
Using the guide https://www.sql-workbench.eu/manual/commandline.html#commandline-connect-noprofile
to set up as profile and save the profile for future use.
This is possible manually via "7.2. Managing profile groups"
https://www.sql-workbench.eu/manual/profiles.html#profile-workbench-settings
Is it possible to save a profile via the command line?
SQLWorkbench64.exe -username=user -password=pass -url=jdbc.. -driver=Redshift driverJar=filepath
There is no direct support for this.
But you can use the WbStoreProfile command to store the currently active connection as a profile.
You can do this through the -command parameter.
SQLWorkbench64.exe -command="WbStoreProfile -name=test" -username=user -password=pass -url=jdbc.. -driver=Redshift driverJar=filepath
That will connect to the database, then run the WbStoreProfile command and exit again.
The profile will be saved under the name "test" in wb-profiles.properties.
But it's probably easier to edit wb-profiles.properties manually.
Using the Azure Resource Manager PowerShell commands, is there a simple way to tell whether a database is involved in geo-replication role as either a Primary or Secondary? I used to read the Status property returned by Get-AzureSqlDatabase, and a value of 0 meant that the database was Primary. However, there is no corresponding property returned by Get-AzureRMSqlDatabase; it still returns a status column, but the value is "Online" for both primary and secondary databases.
The reason I need this is that I'm trying to maintain dozens of databases across multiple subscriptions and servers, and I am trying to automate actions that should only be taken on the primary databases.
I found a reasonable solution to this problem, making one extra call per database. The commandlet Get-AzureRmSqlDatabaseReplicationLink does exactly what I needed, with one caveat; I know that I'm not supposed to be passing the same value as both ResourceGroupName and PartnerResourceGroupName, but it seems to work (at least for now), so I'm going with it to avoid having to make one call per resource group in the subscription.
Using that, I was able to create this simple function:
Function IsSecondarySqlDatabase {
# This function determines whether specified database is performing a secondary replication role.
# You can use the Get-AzureRMSqlDatabase command to get an instance of a [Microsoft.Azure.Commands.Sql.Database.Model.AzureSqlDatabaseModel] object.
param
(
[Microsoft.Azure.Commands.Sql.Database.Model.AzureSqlDatabaseModel] $SqlDB
)
process {
$IsSecondary = $false;
$ReplicationLinks = Get-AzureRmSqlDatabaseReplicationLink `
-ResourceGroupName $SqlDB.ResourceGroupName `
-ServerName $SqlDB.ServerName `
-DatabaseName $SqlDB.DatabaseName `
-PartnerResourceGroupName $SqlDB.ResourceGroupName
$ReplicationLinks | ForEach-Object -Process `
{
if ($_.Role -ne "Primary")
{
$IsSecondary = $true
}
}
return $IsSecondary
}
}
I am creating a group of users within TFS 2013 and I want to add them to the none default access level (ex. the full access group) but I noticed I am only able to do this through the web interface by adding a TFS Group under that certain level. I am wondering if there is a way to do this via the developer tool (command line) as everything I am doing is being done in a batch script.
Any input would be appreciated. Thanks!
Create 3 TFS server groups; add these groups to the different access levels (e.g. TFS_ACCESS_LEVEL_(NONE|STANDARD|FULL)). Now use the TFSSecurity commandline tool to add groups to these existing and mapped groups(tfssecurity /g+ TFS_ACCESS_LEVEL_NONE GroupYouWantToHaveThisAccessLevel). There is no other way to directly add people to the access levels, except probably through the Object Model using C#.
For the record, tfssecurity may require the URI, which can be obtained via API. This is easy to do in Powershell, here is how to create a TFS group
[psobject] $tfs = get-tfs -serverName $collection
$projectUri = ($tfs.CSS.ListAllProjects() | where { $_.Name -eq $project }).Uri
& $TFSSecurity /gc $projectUri $groupName $groupDescription /collection:$collection
Full script at TfsSecurity wrapper.
I have a program that will run a query, and return results in report viewer. The issue is we have 10 locations, all with their own local database. What I'd like to do is have each location use the program and utilize the App.config file to specify which database to connect to depending on which location you are. This will prevent me from having to create 10 individual programs with separate database connections. I was thinking I could have 3 values in the app.config file "Database" "login" "password" Generally speaking the databases are on the .30 address... so it would be nice to be able to have them set the config file to the database server IP...
For example:
Location: 1
DatabaseIP: 10.0.1.30
Login: sa
Password: databasepassword
Is it possible to set something like this up using the app.config file?
You should take a look on the resource files.
Originally, they are intended for localization, but they should work for you also.
Go to your project Properties, and set up an Application Setting --> Type (Connection String) from the drop down. This will result in a xlm config file in your output directory in which you can modify the connection string post-compile.
I ended up using a simple XML File to do this. I used this site to accomplish it. I first wrote the XML using the form load, then switched it to the read.
I would like to create a powershell script that I can run to backup objects to file before updating them. My goal is to backup objects before changing them in case something breaks. I would like to pass in parameters to run like the following:
backupobjects.ps1 -servername -databasename -schemaname -objectname -outputdirectory
So if I call this powershell script and pass in parameters the script will connect to the database and find the object and save the CREATE script and save the object to the outputdirectory passed in and put BEFORE_objectname.sql as the filename.
I am just starting in powershell so accepting parameters I have not learned yet.
Any guidance or suggestions would be helpful.
Rather than write it for you, here are a couple of nudges:
1) param is how you pass in parameters in powershell. I like to do it like so:
param (
[string] $server = (Read-Host "Enter a server name"),
[string] $db = (Read-Host "Enter a database name")
)
you then reference $server and $db later in your script as though you'd explicitly initialized them.
2) Most (if not all) objects in SQL server have a Script() method attached to them. For instance take a look at the Table class.
3) You can control how objects are scripted using the ScriptingOptions class. When you invoke the Script() method on an object, pass a ScriptingOptions object as an argument and the scripting behavior will be governed it.