sqlapi: library to connect to your erlang server via SQL

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

sqlapi: library to connect to your erlang server via SQL

Max Lapshin-2
Hi.


We have released our sqlapi library:  https://github.com/flussonic/sqlapi

This library can help you to make an SQL server from your existing server.

For example you have a server and let it be ejabberd. You want to give a list of connected users.
Of course you will start from making HTTP endpoint that will reply with JSON with list of users.

Then you will add some sort, filter, paging as query params and then will write library that allows to make all this params and send them.

Another option is to put our sqlapi library, connect it to storage of connected users and then connect to server as if it is a SQL server.


Here another real example:  https://flussonic.com/doc/api/sql-cluster   User can connect to our flussonic server and access whole cluster by sending commands like INSERT, UPDATE, DELETE or READ.


This approach may be convenient if you have table data and mainly CRUD operations.


Similar approach is used in Sphinx search engine:  http://sphinxsearch.com/docs/latest/sphinxql.html

We have created all this to connect from python sqlalchemy and Ruby on Rails to Flussonic.
If you want the same, this library may help.


the only dependency is ranch and it is optional, not required for tests.
Some code is derived from https://github.com/altenwald/myproto but we had to remove neotoma sql parser, because we need speed!  Thanks for https://github.com/master/mongosql/blob/master/src/sql92_parser.yrl




_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: sqlapi: library to connect to your erlang server via SQL

Max Lapshin-2
I don't think that it may be required to drop mysql support.   Let it stay.  I just want to say that adding _any_ new ORM is always a pain, because it has yet another way to check if there is a proper mysql on socket.

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: sqlapi: library to connect to your erlang server via SQL

greim
In reply to this post by Max Lapshin-2
Max,

could you explain the purpose or application of your software also for
dummies like me?

Is it a kind of standalone, MySQL compatible server for ets tables?

I am just using in my project about 30 small MySQL tables to hold the
static, non functional, state of my program. Also the user interface,
implemented in HTML / PHP / JScript blablabla is using this tables to
read or set program variables and triggers.

Can I use your software instead? Or can I mirror my MySQL tables to
Erlang and vice versa ?

Regards

Markus




Am 12.03.2018 um 15:34 schrieb Max Lapshin:

> Hi.
>
>
> We have released our sqlapi library: https://github.com/flussonic/sqlapi
>
> This library can help you to make an SQL server from your existing server.
>
> For example you have a server and let it be ejabberd. You want to give a
> list of connected users.
> Of course you will start from making HTTP endpoint that will reply with
> JSON with list of users.
>
> Then you will add some sort, filter, paging as query params and then
> will write library that allows to make all this params and send them.
>
> Another option is to put our sqlapi library, connect it to storage of
> connected users and then connect to server as if it is a SQL server.
>
>
> Here another real example: https://flussonic.com/doc/api/sql-cluster 
>   User can connect to our flussonic server and access whole cluster by
> sending commands like INSERT, UPDATE, DELETE or READ.
>
>
> This approach may be convenient if you have table data and mainly CRUD
> operations.
>
>
> Similar approach is used in Sphinx search engine:
> http://sphinxsearch.com/docs/latest/sphinxql.html
>
> We have created all this to connect from python sqlalchemy and Ruby on
> Rails to Flussonic.
> If you want the same, this library may help.
>
>
> the only dependency is ranch and it is optional, not required for tests.
> Some code is derived from https://github.com/altenwald/myproto but we
> had to remove neotoma sql parser, because we need speed!  Thanks for
> https://github.com/master/mongosql/blob/master/src/sql92_parser.yrl
>
>
>
>
>
> _______________________________________________
> erlang-questions mailing list
> [hidden email]
> http://erlang.org/mailman/listinfo/erlang-questions
>

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: sqlapi: library to connect to your erlang server via SQL

Max Lapshin-2
This is not about mysql _server_.

Look, we write a video streaming server flussonic.  It has some running video streams inside and connected users that are watching live stream.

It is possible to connect to flussonic with mysql command line tool or from PHP and run sql query:  "SELECT * FROM streams"

sqlapi parses this request and sends it to function   my_cluster:select/3 that  collects from ets all information about streams and
sends this reply back.

PHP thinks that there is mysql server, but there is no mysql server.  All data is sent from RAM from ets tables. 

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: sqlapi: library to connect to your erlang server via SQL

Heinz N. Gies
That’s pretty cool stuff!

> On 17. Mar 2018, at 20:02, Max Lapshin <[hidden email]> wrote:
>
> This is not about mysql _server_.
>
> Look, we write a video streaming server flussonic.  It has some running video streams inside and connected users that are watching live stream.
>
> It is possible to connect to flussonic with mysql command line tool or from PHP and run sql query:  "SELECT * FROM streams"
>
> sqlapi parses this request and sends it to function   my_cluster:select/3 that  collects from ets all information about streams and
> sends this reply back.
>
> PHP thinks that there is mysql server, but there is no mysql server.  All data is sent from RAM from ets tables.
> _______________________________________________
> erlang-questions mailing list
> [hidden email]
> http://erlang.org/mailman/listinfo/erlang-questions

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: sqlapi: library to connect to your erlang server via SQL

greim
In reply to this post by Max Lapshin-2
Am 17.03.2018 um 20:02 schrieb Max Lapshin:

> This is not about mysql _server_.
>
> Look, we write a video streaming server flussonic.  It has some running
> video streams inside and connected users that are watching live stream.
>
> It is possible to connect to flussonic with mysql command line tool or
> from PHP and run sql query:  "SELECT * FROM streams"
>
> sqlapi parses this request and sends it to function  
>   my_cluster:select/3 that  collects from ets all information about
> streams and
> sends this reply back.
>
> PHP thinks that there is mysql server, but there is no mysql server.  
> All data is sent from RAM from ets tables.

Thanks Max
now I understand it, thats what I assumed.
I will test it for my application, its a kind of software PLC.

Markus
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: sqlapi: library to connect to your erlang server via SQL

Edmond Begumisa
In reply to this post by Max Lapshin-2
Wow. EXCELLENT WORK!!

This is an *AWESOME* extremely useful idea. And your timing couldn't have  
been more perfect for me.

I work on a team where there are a number of non-Erlang programmers.  
Frequently, I encounter two time-consuming tasks that this could solve:

1. Expose an API to an OTP app for non-Erlangers on the team to access.
2. Expose a CLI for operators and other programmers.

I frequently go through the pain of writing yet another HTTP API to deal  
with 1). Your tool can make it easy in many instances to whip up a  
prototype API accessed over SQL for python, js and other developers to  
use. Everyone on my team who doesn't speak Erlang speaks fluent SQL.  
Moreover SQL would make an API very flexible.

I usually deal with 2) by adding custom REPL to the Erlang SSH app. This  
also involves some tedium because for the CLI to be useful, it has to be  
flexible which means you have to envisage all kinds of scenarios that  
operators will want to deal with. A WMI-like SQL CLI would make this much  
much easier since where we deploy, operators also tend to speak SQL.

And this week, I just started working on a dreaded HTTP API for a new OTP  
app. I can abandon that code now!

Thanks a lot for this. I think this is going to have a profound impact on  
my projects.

- Edmond -


On Tue, 13 Mar 2018 01:34:53 +1100, Max Lapshin <[hidden email]>  
wrote:

> Hi.
>
>
> We have released our sqlapi library:  https://github.com/flussonic/sqlapi
>
> This library can help you to make an SQL server from your existing  
> server.
>
> For example you have a server and let it be ejabberd. You want to give a  
> list of connected users.
> Of course you will start from making HTTP endpoint that will reply with  
> JSON with list of users.
>
> Then you will add some sort, filter, paging as query params and then  
> will write library that allows >to make all this params and send them.
>
> Another option is to put our sqlapi library, connect it to storage of  
> connected users and then >connect to server as if it is a SQL server.
>
>
> Here another real example:  https://flussonic.com/doc/api/sql-cluster   
> User can connect to our >flussonic server and access whole cluster by  
> sending commands like INSERT, UPDATE, DELETE or READ.
>
>
> This approach may be convenient if you have table data and mainly CRUD  
> operations.
>
>
> Similar approach is used in Sphinx search engine:  
> http://sphinxsearch.com/docs/latest/sphinxql.html
>
> We have created all this to connect from python sqlalchemy and Ruby on  
> Rails to Flussonic.
> If you want the same, this library may help.
>
>
> the only dependency is ranch and it is optional, not required for tests.
> Some code is derived from https://github.com/altenwald/myproto but we  
> had to remove neotoma sql >parser, because we need speed!  Thanks for  
> https://github.com/master/mongosql/blob/master/src/>sql92_parser.yrl
>
>
>
>



--
Using Opera's mail client: http://www.opera.com/mail/
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: sqlapi: library to connect to your erlang server via SQL

Max Lapshin-2
Great!

Let's try to use it!

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions