GithubHelp home page GithubHelp logo

mgclient's Issues

Add zig compatibility

SOURCE: https://discord.com/channels/842007348272169002/842008652377751582/1191840879812554834

export CC="zig cc"
export CXX="zig c++"
cmake ..
make

zig.build

exe.linkLibC();
exe.linkSystemLibrary("mgclient");

TODO: Add under examples

const mgclient = @cImport(
    @cInclude("mgclient.h"),
);
pub fn main() !void {
    const initialization = mgclient.mg_init();
    std.debug.print("we initialized mgclient? {d}\n", .{initialization});
    const mg_client_version = mgclient.mg_client_version();
    std.debug.print("Here is the mgclient version from zig: {s}\n", .{mg_client_version});
}

Synchronous calls to server?

Hi, this looks like its synchronous blocking functions am I right? Then if I wish to make many calls, can I

  1. Do them in parallel threads, is it thread safe?
  2. Should I be doing them in threads, what if I want to run 1000 calls at the same time, 1000 threads?

[BUG] Mgclient "failed to send chunk data" error when running execute_and_fetch() in Python Flask Application

Memgraph version Which version did you use?

2.6

Environment Some information about the environment you are using Memgraph
on: operating system, how do you connect, with or without docker, which driver
etc.

Operating System: Amazon Linux 2.
Use Docker w/ default settings.

Describe the bug A clear and concise description of what the bug is.

I have a Python Flask web application. One of the pages has a form that when submitted, calls Memgraph.exceute_and_fetch() to query the Memgraph database using data in the form. The returned data will then be used to populate a Memgraph Orb graph and render it to the user on new page.

Sometimes, instead of receiving node/edge data from the query, a Database Error will be returned, typically on users' first session or first session in a while. Specifically, this is an mgclient error that say "failed to send chunk data". Upon page refresh/form resubmission, the query is successful and the results render as normal and the error is not encountered again (until a future session, typically hours or day(s) later).

To Reproduce Steps to reproduce the behavior:

  1. Have Memgraph instance running and connect to that Memgraph instance using GQLAlchemy in a Python Flask Application.
  2. Have a page in the Flask Application with a form in it, and upon form submission, will run a query using GQL Alchemy's Memgraph.execute_and_fetch() method.
  3. If successful, the query will run as normal and return intended results/redirect users to the right page. However, on occasion (for a reason I can't quite narrow down), the mgclient error will be thrown. (Picture below)
  4. If the error is thrown, refreshing page and resubmitting form should always result in query being successful.

Expected behavior A clear and concise description of what you expected to
happen.

I expect the query to be successful on the first try, rather than upon a form resubmission (or repeating the excecute_and_fetch() call on the backend to ensure users don't see the error. This has "solved" the problem currently from a user standpoint, but we still see the error printed in the terminal logs. )

Logs If applicable, add logs of Memgraph, CLI output or screenshots to help
explain your problem.

image
image

Additional context Add any other context about the problem here.

DB and Query are initialized/run like this:

from gqlalchemy import Node, Field, Relationship, Memgraph, Path
db = Memgraph(host='host-link.net', port=7687)
query_result = db.execute_and_fetch(query=query, connection=db)
results = list(query_result)
  • Currently, the Flask app is being run in the same server as the Memgraph database.
  • Error text/throw seems to be found here:
    mg_session_set_error(session, "failed to send chunk data");

Variable Length Cypher Query over all Relationship Types

Hello! Thank you VERY much for the great tool and, especially, for all the great docs & examples!

I'm trying to perform a query like:

MATCH p=(from)-[rel *1..3]->(to) WHERE from.name = "Bob" AND to.name = "Frank" RETURN p

I.e. All paths of length 1..3 from "Bob" to "Frank" regardless of the relation type. I see how to do a variable length query with certain relationships, but not with all. Am I missing something in the docs? I have all the relationship types, so I could just build a string (:FRIENDS_WITH:RELATED_TO:DATED) and add the *1..3 at the end. But I just want to see if I'm missing something before I add that complexity. THANK YOU!

can not be used when making a PIE object; recompile with -fPIE

  • CentOS 7
  • CMake 3.20.2
  • OpenSSL 1.1.1k
  • GCC 8.5.0

I build this project in CentOS 7 and I want to take use of it in Rust.
However, it reported this error that I can not handle. I am not familiar with cmake so it is hard to solve it.

  = note: /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/libmgclient.a(mgclient.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
          /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/libmgclient.a(mgmessage.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
          /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/libmgclient.a(mgsession.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
          /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/libmgclient.a(mgsession-decoder.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
          /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/libmgclient.a(mgsession-encoder.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
          /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/libmgclient.a(mgtransport.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
          /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/libmgclient.a(mgvalue.c.o): relocation R_X86_64_32 against symbol `mg_system_allocator' can not be used when making a PIE object; recompile with -fPIE
          /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/libmgclient.a(mgsocket.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
          /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/libmgclient.a(mgallocator.c.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE
          collect2: error: ld returned 1 exit status

I try to add "-no-pie" option but it did not help at all.

set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE -no-pie")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIE -no-pie")

# Set default build type to 'Release'
if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE "Release")
endif()
message(STATUS "CMake build type: ${CMAKE_BUILD_TYPE}")

GQLAlchemy install fails because of mgclient dependencies

GQL is hard to install for usage on AWS Lambdas because of the dependencies, probably because OS environment is striped compared to conventional Linux images, so it probably requires a bit more steps.

The user tried to create an identical environment in custom docker image, running amazonlinux:2 :
pip3 install -t python gqlalchamy

First, the typical issues with OpenSSL not being visible popped out:

CMake Error at /usr/share/cmake3/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
  system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY) (found
  version "1.0.2k") 

After installing OpenSSL-static, zlib, and zlib-static, the OpenSSL issue disappeared, and a strange linker failure was hit:

image

The user moved to the Neo4j Python driver.

Full context: https://discord.com/channels/842007348272169002/842338690109931520/1146269544118227054

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.