Query in prisma mysql order by distance - mysql

How can i use prisma ORM with mysql database (planetscale) and query the nearst objects distances (lat and long)?
I have tryed to search the solution, but i found only ways to solve this on Postgresql database with Postgis

Related

Possible to get a listing of MySQL system functions from a query

To get the UDF's in MySQL I can query the information schema. For example:
SELECT * FROM ROUTINES WHERE ROUTINE_SCHEMA='avails' AND ROUTINE_TYPE='FUNCTION'
Is there a similar way to pull the system/global functions, such as ABS(...), from query?
Seems it's not available in INFORMATION_SCHEMA, but possibly another database that isn't installed by default? It is possible to get the list of all MySQL system functions?

Whats the equivalent of ST_DWithin (PostGIS - PostgreSQL) for MySQL?

I am trying to find an efficient way to do proximity queries, ie to return POINTs which are within a radius from a central POINT.
I understand that PostGIS's ST_DWithin method is a good way to do this in PostgreSQL and that it uses the INDEX.
I am currently using ST_Distance_Sphere(g1, g2 [, radius]) which returns the minimum spherical distance between Point on a sphere, in meters.
SELECT placeNames FROM myPlaces
WHERE ST_Distance_Sphere(placeLocation, POINT(28.861105, 77.337)) < 10000
I'm using the WHERE clause to filter the rows. Is the query using the index? If no, is there a better approach to implement the same.
I'm using MySQL 5.7.26 and 8.0.16, both running the default InnoDB database engine.
At this point in MySQL, there seems to be no 'more efficient' alternative to ST_Distance_Sphere or any other which uses a spatial index.
Firtly SRID set this query 4326 use it;
sample
SELECT ST_SetSRID(ST_MakePoint(-71.1043443253471, 42.3150676015829),4326);

Bind MySQL, Cassandra through Postgres

I have a doubt with this.
I'm using postgres to connect two different databases. I'm already can write in both, I can write in MySQL using the mysql_fdw and also I can write values on Cassandra using the Multicorn fdw, but now the thing is that I want to write on both databases from Postgres.
When I when make \du in Postgres I get that the two extensions are loaded (mysql_fdw and multicorn for cassandra), also when I make select * from information_schema._pg_foreign_servers; I got the name of both, I already have created the database and table name on MySQL and the keyspace and columnfamily on Cassandra.
My doubt now is how can I connect both to replicate the data?

Tungsten-replicator from MySQL to MongoDB

When speaking of replicating data from MySQL to MongoDB,It seems that the tables in MySQL are almost the same as MongoDB's collections.However I want to take the MongoDB's flexible schema into considerations to map a relation database into a database in MongoDB with different data schema.So How can I tell the Tungsten-replicator using a special applier to replicate the data?
For example:I have a MySQL database named A,with 10 tables,however when considering MongoDB schema,I build a same database in MongoDB with 6 collections which map the models from MySQL database A.Now I want to replicate the data from MySQL to MongoDB,how can I do that?

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

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/