We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8a71992 commit c2a5848Copy full SHA for c2a5848
2 files changed
qstrings/Q.py
@@ -68,6 +68,7 @@ def __new__(
68
qstr.id = int(f"{datetime.now():%y%m%d%H%M%S%f}")
69
qstr.refs = refs # references used to create the Q string
70
qstr.file = _path if file else None
71
+ qstr.alias = kwargs.get("alias")
72
qstr.exec_id = 0
73
qstr.duration = 0.0
74
qstr._quiet = kwargs.get("quiet", False)
tests/test_Q.py
@@ -42,6 +42,11 @@ def test_from_file():
42
assert q.file and q.file.name == "test_format.sql"
43
44
45
+def test_alias():
46
+ q = Q("SELECT 42 AS answer", alias="blah")
47
+ assert q.alias == "blah"
48
+
49
50
def test_parse_error():
51
q = Q("SELE 42")
52
assert q.ast_errors
0 commit comments