Repointing existing workbooks from Oracle to AWS-RDS in Tableau? - mysql

I have 70 workbooks where all the worksheets are connected to oracle data source. My team is going to migrate the exact same data on Amazon RDS. So now I want to repoint all the Tableau worksheets to the mysql. Is this possible without recreating anything? If so, is there a way to do it for all the worksheets as opposed to just one at a time? I tried with all the methods mentioned on Jawon Apr 30, 2009 3:16 PM posts:- Repointing existing workbook to a new datasource , but nothing worked for me. Is there any way where I can find the mapping of oracle connection for example:- name='oracle.41528.731775173612' in the .twb file to tables and schemas?

It's not easy or pretty but it can be done. It involves hacking the XML of the twb file. These steps give you a general idea and there are ways to streamline the process. Before starting this process, I strongly encourage you to make a backup copy of your twb files. If this goes wrong and you don't have a backup, there's no recovery.
Make a copy of your twb file.
Open the copy. Create a new data source pointing to the new location. Build out that data source. Save your workbook.
Run a diff between the original and new twb files. Look for the connection information that is different.
Using a text editor or other program that can make changes to multiple text files, do a search and replace. I use Notepad++ for this. There are plenty of options out there.
Essentially what you are doing is finding what changed in the connection info when you modified the first file. Then you apply that change to all the other files.
Things get complicated if you have schema name changes or any other types of changes to table name or columns. For that reason, it may be advisable to change the files one at a time, opening each one in Tableau to correct any problems as you find them.

Related

How to save new Django database entries to JSON?

The git repo for my Django app includes several .tsv files which contain the initial entries to populate my app's database. During app setup, these items are imported into the app's SQLite database. The SQLite database is not stored in the app's git repo.
During normal app usage, I plan to add more items to the database by using the admin panel. However I also want to get these entries saved as fixtures in the app repo. I was thinking that a JSON file might be ideal for this purpose, since it is text-based and so will work with the git version control. These files would then become more fixtures for the app, which would be imported upon initial configuration.
How can I configure my app so that any time I add new entries to the Admin panel, a copy of that entry is saved in a JSON file as well?
I know that you can use the manage.py dumpdata command to dump the entire database to JSON, but I do not want the entire database, I just want JSON for new entries of specific database tables/models.
I was thinking that I could try to hack the save method on the model to try and write a JSON representation of the item to file, but I am not sure if this is ideal.
Is there a better way to do this?
Overriding save method for something that can go wrong or that can take more than it should is not recommended. You usually override save when changes are simple and important.
You can use signals but in your case it's too much work. You can instead write a function to do this for you but still not exactly after you saved the data to database. You can do it right away but it's too much process unless it's so important for your file to be updated.
I recommend using something like celery to run a function in the background separated from all of your django functions. You can call it on every data update or each hour for example and edit your backup file. You can even create a table to monitor the update process.
Which solution is the best is highly depended you and how important the data is. And keep in mind that editing a file can be a heavy process too so creating a backup like everyday might be a better idea anyway.

recovering a mysql database using a copy of the datafiles

The primary HDD drive of my computer died yesterday, I got a new one and restored it but when I went to restore my mysql databases I realize I had no done a proper backup in a while.
Nevertheless, I do have the original database files from my previous installation as the datafiles were in the second HDD.
My question is, can I restore/create a new DB in the new machine using only the files from the previous installation?
Thank,
Ignacio
Yes, you should be able to do this.
I'm a bit unclear: when you say, "I do have the original database files" do you mean as a database? If so, go to phpMySql for the surviving database and choose Export. Export the database as a text file. Open the file with your favorite text editor and change the name of the database to match the name you are importing into.
Create the empty database where you want the new one to be, if it doesn't already exist. Now go to phpMySql for that database and import your text file. This should recreate all the tables and their data in the new location.
If instead, you only have the files that were the source of the data, then you need to use whatever tool was used to create the database in the first place. For example, if the data is in the form on an Excel spreadsheet, you would use MySql for Excel.
Hope this helps!
(after your comment that you have file backups of WordPress site)
In that case, you may not be so lucky. If you used a tool to do your backup, it may have backed up the database, but in general, the database is stored separately from your file system. So if you just copied the files yourself, you won't have the database. But do look for any file with a suffix of .SQL, which would be a database backup.
Next, contact your Internet Service Provider and see if they do periodic database backups. If so, you can recover from them.
For the future, see if your ISP provides automated backups (including database). And read https://codex.wordpress.org/WordPress_Backups.

What is the best way to routinely import a CSV or XML file into a MS access database?

I have an Access database that keeps track of many different aspects of my companies performance and I would like to add functionality to keep track of the hours the employees are working.
The hours are all kept track of on a website called timetracker. They have a few reporting options including XML and CSV files. The site has a favorite report feature to get the same data in the format that I want it every week.
What I would like to do is find the best process for getting the data from this website, into a table in my database that I can reference.
I will not be the one executing whatever process I come up with and I would really like it to be as easy as possible for whoever it is that does have to do it.
Right now I have a linked table that is an XML file in our SharePoint folder. I was thinking that maybe we could just run the report and download the file every week then just save it over the old file with the correct sheet names and it should update.
What I am wondering is if anyone can come up with an easier process for doing this that would take the least amount of time and be easiest to write down instructions for that anyone could execute.
(Would it maybe be possible to create some sort of macro to actually download the report automatically?)

Explore database contents from .sql file

I inherited the maintenance of a small web forum. Near as I can tell, it is powered by a MySQL database on the backend (the frontend is all PHP).
I need to extract some of the data (which also involves searching for the data I need to extract), but I don't want to touch the production database. I exported a database backup, which produced a several-hundred-megabyte .sql file.
What's the best way to mine these data? I can see several options:
grep through the .sql script in text mode, trying to extract the relevant data
Load it up in sqlite3 (I tried doing this, but it barfed on some of the statements in the script and didn't produce any tables. I have no database experience whatsoever though, so I haven't ruled it out as a dead end just yet).
Install MySQL on my home box, create a database, and execute the .sql script to recreate the data. Then just attach some database explorer tool.
Find some (Linux) app which can understand the .sql file natively (seems unlikely after a bit of Googling).
Any pointers to which of these options (or one I haven't thought of yet) would be the most productive?
I would say any option might work but for data mining, you definitely want to load it up in a new database so you can start query-ing the data and building reports on the data. I would load it up on your Home box. No need to have it remote.

Renaming fields in linked-table MDB file pair?

I have an Access 2003 database using MS-JET linked tables (that is, there are two *.mdb files). The overall task is to move to SQL server. However the existing databases have multiple fields with spaces and other characters that upset both of the Access migration wizards. So the intermediate task is to make a version of the existing mdb's with updated field names.
"Simply" changing field names in the UI mdb file doesn't work, because of the linked tables being read-only in that mdb. Updating the Data mdb file field names first doesn't work because the UI mdb then throws a wobbly on startup and Access gives up.
I'm looking for suggestions, but options I can see are:
re-integrate the Data mdb back into the UI one, do the updates, then re-export the data. Seems very risky to me (system is live, don't want to play with data any more than strictly necessary).
I've looked at several answers here relating to changing ODBC details with VBA code, which is interesting, and I can see how I might be able to programmatically edit the linked tables' names. Is this going to work? Is there a better way?
Unlink all linked tables, then edit in UI mdb the remaining forms, reports, queries (but would that work??) and edit the Data mdb fields, and finally relink everything. Will it fall apart?? ... seems likely.
Any suggestions?
Ruth
I go through this process every time I take over an existing Access application -- I have to bring it up to my own standards for naming conventions before I do anything significant with it. Recently I built a quick-and-dirty utility to rename fields. It was made for me and has very little error recovery, and a UI that is ugly, but it might be faster than doing it yourself.
See what track name autocorrect offers. How Name AutoCorrect Works in Microsoft Access
Make a copy of your UI MDB, delete the linked tables, then import them (as tables rather than links) from the Data MDB. Once you enable autocorrect, Access will attempt to propagate your field name changes wherever they are used (in forms for example). Unlikely it will catch 100% of the necessary changes, but it should resolve a big chunk of them. You would then need to manually track down and fix the rest.
Once you have everything fixed, you could use that MDB version to "upsize" your tables to SQL Server. However, one huge complication is if the original database is "live" while you're making changes to the new version. If you absolutely can't take the database out of service in the interim, you could discard the data from the new tables, then use "append" queries which alias the old to new field names to pull in the latest data.
INSERT INTO NewTable (emp_id, another_field)
SELECT
[emp ID],
[another field]
FROM OldTable IN 'C:\somefolder\Data.mdb';
Finally, a warning about autocorrect: do not leave it enabled in the production version of your database because strange things can happen. The safest approach IMO is to turn it on, complete your object name changes, then turn it back off again.
You might find Rick Fisher's Find and Replace tool helpful if you need to propagate name changes through the project. I've relied on it for years (though I don't do much Access development lately): http://www.rickworld.com/products.html
I think this tool will change the names of tables and fields for you but I am not sure. I mostly used it for finding references to tables and queries in other queries, form and report properties, and VBA code.