How do I rename a database in influxdb? - r

Looking through the influxdb website, documentation doesn't seem to
cover some functionality that typical db commands would. Does
anyone know how to move to a new name or outright rename a database inside of
influxdb?
Does anyone have a recommendation which R package to use with
influxdb?
Is there a way to load influx with -precision rfc3339 (human
readable timestamping) automatically set within the configuration?

Currently renaming databases is not supported in influxDB. Discussion is going on in influxDB's github repo on the feature's need and complexity.
https://github.com/influxdata/influxdb/issues/4154
The feature was implemented and then reverted due to bugs

Renaming is only possible by copying data into a new database:
SELECT * INTO "copy_NOAA_water_database"."autogen".:MEASUREMENT FROM "NOAA_water_database"."autogen"./.*/ GROUP BY *
Documentation: https://archive.docs.influxdata.com/influxdb/v1.2//query_language/data_exploration/#example-1-rename-a-database
The GROUP BY * clause is important as it preserves the tags.

I have not tried it for myself. But there are some answers in this link https://github.com/influxdata/influxdb.com/issues/384
ALTER DATABASE <db> RENAME TO <new_db>

Related

Alternate to fallbackToDestructiveMigration()?

I don't want to provide a migration script while changing table schema in realm java. Also, app should not crash and all the previous data should be erased or truncated something similar to fallbackToDestructiveMigration() as room dose?
Realm provides RealmConfiguration.Builder().deleteIfMigrationNeeded()..., where deleteIfMigrationNeeded() does exactly what you are looking for.

Is there a quick way to locate the SQLite database that my app creates?

I used this blog post as a basis for creating my SQLite tables.
Using the SQL Server Compact/SQLite Toolbox, I can view the created tables nicely.
However, in order to first create the connection in that tool, I had to locate the SQLite database I had created. I did a hard drive search for it, and found it in:
C:\Users\Clay\AppData\Local\Packages\99129e92-ebeb-4800-a0e5-
d0e43b016009_qtyjefqf75sa6\LocalState\photrax.sqlite
Now how in the world would I know that it was in 99129e92-ebeb-4800-a0e5-
d0e43b016009_qtyjefqf75sa6 (there are many similar Welch-looking folder names beneath C:\Users\Clay\AppData\Local\Packages, so how would I know which one it's in)?
Surely there's a more elegant way to find it than doing a global search.
C:\Users\Clay\AppData\Local\Package is where all your apps store their data and 99129e92-ebeb-4800-a0e5-
d0e43b016009 is most likely your package ID from the appx manifest. You can just use ApplicationData.LocalFolder.Path to get the path.

MVC3 Best solution to manage multiple lookup tables

I'm having hard time to find the right solution to manage multiple modificable lookup tables (more than 40), most of them with the same structure. I'm using the repository approach but I can't make it work. Has someone a working example?
Take a look at my repository pattern for EF4.1/4.2 it allows you to easially connect to an EF4.1 DB and query it throughout your solution.
http://blog.staticvoid.co.nz/2011/10/staticvoid-repository-pattern-nuget.html
a working source application is also available here:
http://dl.dropbox.com/u/37129059/StaticVoid.Repository.Demo.zip
A tool that worked great for me is a t4 code generation template that generates enums out of lookup tables. It can save you a lot of work and keep your source code up to date when you add some new items to the look up tables.
I also use a DB with ~30 lookup tables and it was easy to set up, modify and use (even though I did not knew much about t4 templates before).
http://erraticdev.blogspot.com/2011/01/generate-enum-of-database-lookup-table.html

Accessing CoreData tables from fmdb

I'm using CoreData in my application for DML statements and everything is fine with it.
However I don't want use NSFetchedResultsController for simple queries like getting count of rows, etc.
I've decided to use fmdb, but don't know actual table names to write sql. Entity and table names don't match.
I've even looked inside .sqllite file with TextEdit but no hope :)
FMResultSet *rs = [db getSchema] doesn't return any rows
Maybe there's a better solution to my problem?
Thanks in advance
Core Data prefixes all its SQL names with Z_. Use the SQL command line tools to check out the your persistent store file to see what names it uses.
However, this is a very complicated and fragile solution. The Core Data schema is undocumented and changes without warning because Core Data does not support direct SQL access. You are likely to make error access the store file directly and your solution may break at random when the API is next updated.
The Core Data API provides the functionality you are seeking. IJust use a fetch request that fetches on a specific value using an NSExpressionDescription to perform a function. This allows you to get information like counts, minimums, maximums etc. You can create and use such fetches independent of a NSFetchedResultsController.
The Core Data API is very feature rich. If you find yourself looking outside the API for a data solution, chances are you've missed something in the API.

How to plan for schema changes in an SQLite database?

I am currently developing an application that will store data in an SQLite database. The database will have much more read- than write-access (in fact, it will be filled with data once, and then almost only reading will happen). The read-performance is therefore much mre important. The schema I am currently developing is very likely to change in the future, with additional columns and tables being added. I do not have very much experience with databases in general. My question is, specifically in SQLite, are there any pitfalls to be considered when changing a schema? Are there any patterns or best practices to plan ahead for such cases?
Here are some suggestions:
Don't use select * from ... because the meaning of * changes with schema changes; explicitly name the columns your query uses
Keep the schema version number in the database and keep code in the application to convert from schema version N to version N+1; then all the code in the application works with the latest schema version; this may mean having default values to fill added columns
You can avoid copying tables for schema updates with SQLite version 3.1.3 or better which supports ALTER TABLE ADD COLUMN...
Look into data-marts and star schema design. This might be overkill for your situation, but at least it will prevent you from designing at random.

Resources