Comments (3)
@BorisTasevski and @g-despot let's discuss this here sometime soon so that Bruno knows what is best to do next 😄
from gqlalchemy.
Ideas:
-
make .node() accept kwargs in form of tuple, for instance
prop=(value="var", is_variable=True)
, which would then putvar
in properties without the quotes, and if we dont pass a tuple, use the value as is. -
next to kwargs such as
prop="var"
also passprop_is_variable=True
when we need thevar
to be used as variable, and in to_cypher_properties() inside node(), for every kwargs check if there exists _is_variable which is True. -
address this in QueryBuilder 2 and put FOREACH on hold
from gqlalchemy.
Maybe to introduce a new class inside the QueryBuilder logic, for example Property
which will be utilized like this: https://pypika.readthedocs.io/en/latest/2_tutorial.html#tables-columns-schemas-and-databases
def to_cypher_value(value: Any, config: NetworkXCypherConfig = None) -> str:
"""Converts value to a valid Cypher type."""
if config is None:
config = NetworkXCypherConfig()
value_type = type(value)
if value_type == str and value.lower() == "null":
return value
**if isinstance(value, Property): return str(value)** -> makes Property would just have an initializer with its value
if value_type == float and math.isnan(value):
if config.nan_handler == NanValuesHandle.THROW_EXCEPTION:
raise NanException("Nan values are not allowed!")
return "null"
if value_type in [int, float, bool]:
return str(value)
if value_type in [list, set, tuple]:
return f"[{', '.join(map(to_cypher_value, value))}]"
if value_type == dict:
lines = ", ".join(f"{k}: {to_cypher_value(v)}" for k, v in value.items())
return f"{{{lines}}}"
if value is None:
return "null"
if value.lower() in ["true", "false"]:
return value
return f"'{value}'"
Which would eliminate all our needs to have "is_variable" in FOREACH, WHERE, NODE, and other clauses. Not to mention we'll have to change it at all these methods if by some chance a lightbulb hits us with a better implementation
from gqlalchemy.
Related Issues (20)
- Upgrade to pydantic v2 HOT 10
- Migrate docs from Memgraph docs repo to GQLAlchemy repo
- [BUG] Inclusion of the docker dependency bring in pywin32 which has an outstanding vulnerability HOT 1
- [BUG] Relax neo4j dependency version
- Expand LOAD CSV with remote CSV location HOT 2
- [BUG] Missing Cypher operators HOT 2
- Markdown lists in the documentation are not always rendered in the correct way
- [BUG] : undefined symbol: `EVP_PKEY_base_id` (in `mgclient.cpython-39-x86_64-linux-gnu.so`) HOT 19
- Missing documentation section on execute() HOT 1
- GQLAlchemy can't be installed on Windows with Python 3.11 HOT 2
- Propagate autocommit flag from pymgclient to gqlalchemy
- Support: Confusion over usage of `Field` class HOT 8
- Add IS NOT NULL to query builder HOT 1
- undefined symbol: SSL_get1_peer_certificate HOT 10
- Pydantic version HOT 11
- Docs needed for connecting to Memgraph from gqlalchemy HOT 1
- [BUG] CSVLocalFileSystemImporter can't load datetime from csv HOT 17
- [Feature Request] Please allow add edge properties in Loaders HOT 1
- Add Enum support for datatype
- STRING-specific comparison operators HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gqlalchemy.