Can we use mysql and cassandra both in PrestoDB via connector? - mysql

In production system . I am using two different databases (cassandra and
mysql)
I heard about prestoDB and it is kind of amzing tool because we can make
sql query in Cassandra (Big database). Now come to analyze part I have
two different source mysql and cassandra i.e fetch data from sources and query to different source. Is it possible to combine both in prestoDB.
PS : I am facing problem in mysql connector in presto. I have gone
through the documentation but it is not helping much

Yes, and presto is the perfect choice for this kind of query.
First you need to configure cassandra connector and mysql connector.
Then you can combine data in cassandra and mysql in one sql like:
SELECT u.country, COUNT(*) AS cnt
FROM cassandra.tutorial.stream s
JOIN mysql.tutorial.user u
ON s.userid = u.userid
GROUP BY u.country
ORDER BY cnt DESC
LIMIT 5;
Here is a tutorial of how to combine data in hive and mysql using presto, but combine data in cassandra and mysql should be similar.
http://getindata.com/blog/tutorials/tutorial-using-presto-to-combine-data-from-hive-and-mysql-in-one-sql-like-query/

Related

Is it possible to fetch the data from two data source in Apache Superset?

Is it possible to fetch the data from two data source in Apache Superset? For e.g having sql query which fetch the records from MySql and Salesforce on which the slice can be generated.
I will ask for more clarification on this, do you mean to have 2 databases for querying in a single SQL query ? , Like a federated query
select * from mysql.___ inner join salesforce.___ on …. something like this ? , If this is the case, currently unfortunately Superset does not supports it.
Salesforce has lots of products, so can you please clarify which specific DB from Salesforce you are talking about ? And at the moment there is unfortunately now none salesforce's product DB supported.

How to query data across multi databases?

I have several sqlserver and mysql db's. And it's impossible join two or more tables between them.
A thought is to use Hbase on hadoop to achieve this by storing all columns that I need to join. Cause I don't need ad-hoc query and just need sync data to HDFS per day.
But I'm not sure if Hbase is well-suited for that considering I have to filter rows by many conditions.
Does anyone have a suggestion about this?
You could use sqoop to import databases from sqlserver and mysql to HDFS, and then use Hive to query the imported data. Hive supports SQL and you'd be able to execute JOIN with Hive.
I don't think you can do JOINs with HBase.

How to convert MYSQL query into MSSQL query

I've 700+ MySQL queries and now trying to create same set of queries in MSSQL.
I want to generate MSSQL query with same MYSQL.Is any way to convert MYSQL query into MSSQL query.
From this article by Brian Swan, you can download the SQL Server Migration Assistant for MySQL tool and use it to convert a single MySQL query to a SQL Server query:
Create a Project: All the information you need for downloading SSMA, creating a project and connecting to databases is in steps 1-6 of this blog post.
In the MySQL Metadata Explorer, navigate to the Statements directory of your MySQL database:
Paste the query you want to convert into the query editor window, e.g:
SELECT post_title, post_date FROM wp_posts ORDER BY post_date LIMIT 5 OFFSET 5;
Back in the MySQL metadata explorer, right-click Statements and select Convert Schema:
When prompted to save changes, select Yes:
Copy the converted query from the SQL Server query editor window:
Note that SSMA will not successfully translate all MySQL queries, but it does for most. It does not translate some MySQL-specific functions (for example FOUND_ROW()).

Is it possible to get information from different database with inner join having database in SQL and mySql?

I have my project A with mySql database and I have another project B with msSql. I have connected the database from A and fetched data from B. But now I need to use inner join for tables in A and B. Is it possible to do so with databases in the same server and different server? Any help will be appreciated.
Thanks in advance
Yes, it should be possible. First, you will need to link your MySQL server to your MS SQL Server.
See this reference. Secondly, you will probably need to use sub queries to select the correct columns and do the join on them;
SELECT *
FROM
(SELECT ms_column1, ms_column2 FROM MSSQLTABLE) AS mssql
JOIN
(SELECT my_column1, my_column2
FROM openquery(LINKED_SERVER, 'SELECT column1, column2 FROM MYSQLTABLE') AS mysql
ON mssql.ms_column1 = mysql.my_column1
Unfortunately untested.
Instead of making the two different databases communicate between themselves you can move the logic of the communication to the programming layer. For example using PDO and PHP you can connect to both databases, get the data, mix it and produce a result. You can create an abstraction layer of PHP classes that get information independently from A or B databases, and later you will not care anymore about it, as you will work with PHP objects not directly with databases.

Utility to create "data dictionary" for MySQL database

I'm wondering if there is a utility that exists to create a data dictionary for a MySQL database.
I'm considering just writing a php script that fetches the meta data about the database and displays it in a logical format for users to understand but I'd rather avoid that if there is some pre-built utility out there that can simply do this for me.
Have you looked into HeidiSQL or phpMyAdmin?
Also, MySQL Admin.
Edit#1 fixed typo, added more info
Take a look at https://stackoverflow.com/a/26703098/4208132
There is a db_doc.lua plugin for MySQL Workbench CE
[EDITED]
It seems that the LUA plugin support was discontinued.
So I wrote a plugin in Python to generate data dictionaries.
It is available at: https://github.com/rsn86/MWB-DBDocPy
Looks like MySQL Admin is now MySQL Workbench and you need the Enterprise version to get their reporting tool called DBDoc. It explains a little about customizing DBDoc reporting templates at http://dev.mysql.com/doc/workbench/en/dbdoc-templates.html
The easiest thing to do is Download Toad for MySQL, which is free, and create your own query against the mysql information_schema internal database. You can add columns you want to the query below. Then select all results and export as csv using TOAD.
use information_schema;
desc columns;
select c.table_name, c.column_name, c.data_type from columns c
where c.table_schema = "mydatabaseinstance";