You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@age.apache.org by "glazkovalex (via GitHub)" <gi...@apache.org> on 2023/01/31 08:29:51 UTC

[GitHub] [age] glazkovalex opened a new issue, #640: How to use this Apache Age from .Net 7.0?

glazkovalex opened a new issue, #640:
URL: https://github.com/apache/age/issues/640

   For Apache Age there is a driver for Python, Golang and a couple of other languages, but there is no driver in C# for .Net 7.0. How to use this graph DBMS from .Net 7.0?
   
   If there is, give a link to an example connection from .Net.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@age.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] How to use this Apache Age from .Net 7.0? [age]

Posted by "Allison-E (via GitHub)" <gi...@apache.org>.
Allison-E commented on issue #640:
URL: https://github.com/apache/age/issues/640#issuecomment-1819561633

   Hi. I've created an AGE driver for .NET, and it currently supports only .NET 8 (support for other versions and .NET Standard coming soon). You can check it out here: [https://github.com/Allison-E/pg-age](https://github.com/Allison-E/pg-age).
   
   To know how it works, you should take a look at the [wiki](https://github.com/Allison-E/pg-age/wiki) (even though it's still under construction).
   
   Your contributions and suggestions are welcomed 😄.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] How to use this Apache Age from .Net 7.0? [age]

Posted by "glazkovalex (via GitHub)" <gi...@apache.org>.
glazkovalex commented on issue #640:
URL: https://github.com/apache/age/issues/640#issuecomment-1765907011

   > [hammadsaleem1100@gmail.com](mailto:hammadsaleem1100@gmail.com) Как использовать Apache Age из .Net 7.0? #640
   > 
   > Чтобы использовать его из .NET 7.0, вы можете выполнить следующие общие шаги:
   > 
   > Установите библиотеку Npgsql, которая является поставщиком данных .NET для PostgreSQL.
   > 
   > Установите Apache Age как расширение PostgreSQL.
   > 
   > Подключитесь к базе данных PostgreSQL с помощью Npgsql.
   > 
   > Выполняйте запросы Age в PostgreSQL с помощью командного объекта Npgsql.
   > 
   > Вот пример фрагмента кода C# для подключения к базе данных PostgreSQL и выполнения запроса Age:
   > 
   > использование Npgsql;
   > 
   > var connString = "Host=myserver;Имя пользователя=mylogin;Пароль=mypass;База данных=mydatabase"; используя var conn = new NpgsqlConnection(connString); конн.Открыть();
   > 
   > var cmd = new NpgsqlCommand("MATCH (n) RETURN n", conn); вар читатель = cmd.ExecuteReader(); while (reader.Read()) { // Обрабатываем результаты }
   > 
   > читатель.Закрыть();
   > 
   > Обратите внимание, что запрос Age — это стандартный запрос PostgreSQL с синтаксисом языка запросов Cypher. Вы также можете использовать адаптер Npgsql для выполнения команд Age, синтаксис которых аналогичен запросам Cypher.
   
   
   
   > [hammadsaleem1100@gmail.com](mailto:hammadsaleem1100@gmail.com) How to use this Apache Age from .Net 7.0? #640
   > 
   > To use it from .NET 7.0, you can follow these general steps:
   > 
   > Install the Npgsql library, which is the .NET data provider for PostgreSQL.
   > 
   > Install Apache Age as a PostgreSQL extension.
   > 
   > Connect to your PostgreSQL database using Npgsql.
   > 
   > Execute Age queries in PostgreSQL using the Npgsql command object.
   > 
   > Here's an example C# code snippet to connect to a PostgreSQL database and execute an Age query:
   > 
   > using Npgsql;
   > 
   > var connString = "Host=myserver;Username=mylogin;Password=mypass;Database=mydatabase"; using var conn = new NpgsqlConnection(connString); conn.Open();
   > 
   > var cmd = new NpgsqlCommand("MATCH (n) RETURN n", conn); var reader = cmd.ExecuteReader(); while (reader.Read()) { // Process the results }
   > 
   > reader.Close();
   > 
   > Note that the Age query is a standard PostgreSQL query with the syntax of the Cypher query language. You can also use the Npgsql adapter to execute Age commands, which have a similar syntax to Cypher queries.
   
   Thank you!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] M4rcxs commented on issue #640: How to use this Apache Age from .Net 7.0?

Posted by "M4rcxs (via GitHub)" <gi...@apache.org>.
M4rcxs commented on issue #640:
URL: https://github.com/apache/age/issues/640#issuecomment-1463195594

   An alternative is to use [Npgsql.org ](https://www.npgsql.org) whose is a driver of PostgreSQL for C#, but for now does not exist a driver for Apache AGE from .NET, maybe in the future this feature will be developed to Npgsql


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] How to use this Apache Age from .Net 7.0? [age]

Posted by "glazkovalex (via GitHub)" <gi...@apache.org>.
glazkovalex closed issue #640: How to use this Apache Age from .Net 7.0?
URL: https://github.com/apache/age/issues/640


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] How to use this Apache Age from .Net 7.0? [age]

Posted by "LakshyaNandwana (via GitHub)" <gi...@apache.org>.
LakshyaNandwana commented on issue #640:
URL: https://github.com/apache/age/issues/640#issuecomment-1790982026

   @rafsun42 Yes, the query can be executed from the command line.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] FahadZaheerfzr commented on issue #640: How to use this Apache Age from .Net 7.0?

Posted by "FahadZaheerfzr (via GitHub)" <gi...@apache.org>.
FahadZaheerfzr commented on issue #640:
URL: https://github.com/apache/age/issues/640#issuecomment-1411917619

   There is no driver for .Net yet but what you can do is use some existing library to connect to PostgreSQL and then load Apache Age using PostgreSQL queries. Once you load it you can run the queries just like in PostgreSQL. For loading Apache Age make sure you have Apache Age installed and set up in localhost.
   
   To load Apache Age use these commands
   
   ```
   CREATE EXTENSION IF NOT EXISTS age;
   LOAD 'age';
   SET search_path = ag_catalog, "$user", public;
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] How to use this Apache Age from .Net 7.0? [age]

Posted by "LakshyaNandwana (via GitHub)" <gi...@apache.org>.
LakshyaNandwana commented on issue #640:
URL: https://github.com/apache/age/issues/640#issuecomment-1793332835

   @rafsun42 Thank you, the query works after adding the ag_catalog to search path.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] pawankukreja01 commented on issue #640: How to use this Apache Age from .Net 7.0?

Posted by "pawankukreja01 (via GitHub)" <gi...@apache.org>.
pawankukreja01 commented on issue #640:
URL: https://github.com/apache/age/issues/640#issuecomment-1706275145

   Currently there is no drivers available for C#, however you can develop a driver for Apache AGE in C# by following instructions provided in [official documentation ](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/websockets?view=aspnetcore-7.0)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] How to use this Apache Age from .Net 7.0? [age]

Posted by "LakshyaNandwana (via GitHub)" <gi...@apache.org>.
LakshyaNandwana commented on issue #640:
URL: https://github.com/apache/age/issues/640#issuecomment-1791888764

   @rafsun42 Can you pleae send me the code on how to add ag_catalog to search path from c# code?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] How to use this Apache Age from .Net 7.0? [age]

Posted by "LakshyaNandwana (via GitHub)" <gi...@apache.org>.
LakshyaNandwana commented on issue #640:
URL: https://github.com/apache/age/issues/640#issuecomment-1790636638

   I'm currently working on updating values using the following code block:
   
   ```csharp
   try
   {
       var connString = "Host=myserver;Username=puser;Password=psqlpw;Database=mydatabase";
       using var conn = new NpgsqlConnection(connString);
       await conn.OpenAsync();
       Console.WriteLine("Connection Successful");
   
       using var cmd = new NpgsqlCommand("SELECT * FROM ag_catalog.cypher('mydata', $$ MATCH(v:Device {DeviceName: 'My Fancy Device'}) SET v.specversion = '3.0' RETURN v $$) as (v agtype) ;", conn);
       cmd.AllResultTypesAreUnknown = true;
       await cmd.ExecuteNonQueryAsync();
       // var reader = cmd.ExecuteReader();
       // reader.Close();
   }
   catch (Exception ex)
   {
       Console.WriteLine(ex.Message);
   }
   
   > I encountered an error: "type 'agtype' does not exist." 
   Do you have any suggestions for executing this update command?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] How to use this Apache Age from .Net 7.0? [age]

Posted by "hhaynes-rower (via GitHub)" <gi...@apache.org>.
hhaynes-rower commented on issue #640:
URL: https://github.com/apache/age/issues/640#issuecomment-1817335635

   I suppose we can all shift forward to talk about .NET 8 now. 👍 😄 
   
   Of course this is about more than simply getting queries out to Postgres but also about efficient compute and memory handling on the "application" side of things. I'll be looking at ways to build a convenient wrapper/extension for Npgsql and have alreayd started looking at some other attempts that have been made over the years. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] How to use this Apache Age from .Net 7.0? [age]

Posted by "glazkovalex (via GitHub)" <gi...@apache.org>.
glazkovalex commented on issue #640:
URL: https://github.com/apache/age/issues/640#issuecomment-1849068266

   > Hi. I've created an AGE driver for .NET, and it currently supports only .NET 8 ...
   > ...
   > Your contributions and suggestions are welcomed 😄.
   
   @Allison-E, hellow!
   A very interesting project! 
   Support.Net.Standard is completely optional, since Npgsql.Entity Framework is Core.PostgreSQL is still under .Net 8. 
   It would be very useful to support Linq in queries, that is, [hybrid queries to relational data and graph data](https://dev.to/dukeofhazardz/exploring-apache-age-hybrid-queries-49p8) in a single Linq query, as well as mapping the results to objects! So that you can combine a Linq query to relational data with a text subquery in the Cypher Query Language via [User-defined function](https://learn.microsoft.com/en-us/ef/core/querying/user-defined-function-mapping), [EF.Functions](https://learn.microsoft.com/en-us/ef/core/querying/database-functions) and [Interceptors](https://learn.microsoft.com/en-us/ef/core/logging-events-diagnostics/interceptors). That is, so that the Entity Framework Core outputs, for example, these queries:
   
   
   ```demo=# SELECT p.name FROM Persons AS p WHERE p.id in (
   demo(# SELECT id FROM cypher('my_graph', $$
   demo$# MATCH (v:Person) RETURN v.id $$)
   demo(# AS (id int));
   ```
   ```
       name
   ------------
    "Daniel"
    "Emmanuel"
   (2 rows)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] hammadsaleemm commented on issue #640: How to use this Apache Age from .Net 7.0?

Posted by "hammadsaleemm (via GitHub)" <gi...@apache.org>.
hammadsaleemm commented on issue #640:
URL: https://github.com/apache/age/issues/640#issuecomment-1429758765

   
   
   hammadsaleem1100@gmail.com
   How to use this Apache Age from .Net 7.0? #640
   
   To use it from .NET 7.0, you can follow these general steps:
   
   Install the Npgsql library, which is the .NET data provider for PostgreSQL.
   
   Install Apache Age as a PostgreSQL extension.
   
   Connect to your PostgreSQL database using Npgsql.
   
   Execute Age queries in PostgreSQL using the Npgsql command object.
   
   Here's an example C# code snippet to connect to a PostgreSQL database and execute an Age query:
   
   using Npgsql;
   
   var connString = "Host=myserver;Username=mylogin;Password=mypass;Database=mydatabase";
   using var conn = new NpgsqlConnection(connString);
   conn.Open();
   
   var cmd = new NpgsqlCommand("MATCH (n) RETURN n", conn);
   var reader = cmd.ExecuteReader();
   while (reader.Read())
   {
       // Process the results
   }
   
   reader.Close();
   
   Note that the Age query is a standard PostgreSQL query with the syntax of the Cypher query language. You can also use the Npgsql adapter to execute Age commands, which have a similar syntax to Cypher queries.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] eyab commented on issue #640: How to use this Apache Age from .Net 7.0?

Posted by "eyab (via GitHub)" <gi...@apache.org>.
eyab commented on issue #640:
URL: https://github.com/apache/age/issues/640#issuecomment-1690869143

   @glazkovalex Any updates on this issue?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] How to use this Apache Age from .Net 7.0? [age]

Posted by "houstonhaynes (via GitHub)" <gi...@apache.org>.
houstonhaynes commented on issue #640:
URL: https://github.com/apache/age/issues/640#issuecomment-1819632358

   Emannuel this is awesome! I've forked it and will spend some quality time with it over the US holiday this week. Thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] uhayat commented on issue #640: How to use this Apache Age from .Net 7.0?

Posted by "uhayat (via GitHub)" <gi...@apache.org>.
uhayat commented on issue #640:
URL: https://github.com/apache/age/issues/640#issuecomment-1416928383

   Use Npgsql which is PG driver for C#. I ideally there should be a AGE plugin for Npgsql.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] How to use this Apache Age from .Net 7.0? [age]

Posted by "rafsun42 (via GitHub)" <gi...@apache.org>.
rafsun42 commented on issue #640:
URL: https://github.com/apache/age/issues/640#issuecomment-1793061084

   @LakshyaNandwana That is a command just like SELECT. So you should be able to run it as you run SELECT from C# code.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] How to use this Apache Age from .Net 7.0? [age]

Posted by "rafsun42 (via GitHub)" <gi...@apache.org>.
rafsun42 commented on issue #640:
URL: https://github.com/apache/age/issues/640#issuecomment-1790968070

   @LakshyaNandwana Does your query work on command line? 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] How to use this Apache Age from .Net 7.0? [age]

Posted by "rafsun42 (via GitHub)" <gi...@apache.org>.
rafsun42 commented on issue #640:
URL: https://github.com/apache/age/issues/640#issuecomment-1791072517

   @LakshyaNandwana Have you loaded age and add ag_catalog to search path from your c# code?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org